« first day (3323 days earlier)      last day (1618 days later) » 

12:00 AM
Listing multiple interfaces would probably need its own symbol and maybe an class pointer array.
I've no idea how that'd work with things that combined scalars and interfaces though o.O seems like code generation would be a useful tool
 
12:33 AM
@MarkR They are referring to the machine code generated in the binary/library.
 
Aye, I meant how much bigger is it realistically going to be?
 
It can be noticeable if all functions use it. I think this is why when they were introduced the idea was to apply it only to places where it it would be beneficial from perf perspective. However, the API is just much nicer, so in practice a lot of code uses it anyway.
 
I'd probably just say screw it and convert the entire codebase to use macros. Then again, I'd also use meaningful variable names in my source code.
 
 
1 hour later…
2:05 AM
'T_BAD_CHARACTER' undeclared – #78846
 
 
1 hour later…
Wes
3:16 AM
any eta on union types implementation?
i will install it hard and run it in production like there's no tomorrow
 
 
4 hours later…
7:10 AM
@Wes what do you mean? They are present in master
 
Wes
oh, i was reading the rfc, they are still listed under "pending implementation"
great then, time to compile :D
 
user10655999
triying to hit sms by using curl in php
 
user10655999
getting error 7 : Failed to connect() to host or proxy.
 
user10655999
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
 
user10655999
7:26 AM
any suggestions ?
 
8:00 AM
avocation something a person does in addition to a principal occupation, especially for pleasure; hobby: Our doctor's avocation is painting.
Important info about return values is tucked away at the end of fourth example – #78848
 
8:37 AM
o/
@Levi holla
I might have a thing for you to try that's quite easy, and extremely low overhead ...
take the cfg from opcache, stick it in an extension so you have the zend_build_cfg api, in extension hook, build the control flow graph, analyse the blocks, find exit and throw points and replace only the opcode handler (like the jit does, so we know it's safe) to route through your opcode handlers (that you did not install) relaying to the original opcode handler (be it jit code or whatever) ...
all you need to test is how opcache serializes the handlers, I think it won't touch them because of jit ...
note, if you copy config.* and cfg folder from pcov repo, you have basically bundled the cfg ... then edit to taste, pcov source is one file, so copy and paste that if you have too ...
shall I just do it ?
 
GD build broken with -D SIGNED_COMPARE_SLOW – #78849
 
cmb
9:19 AM
o/
 
9:55 AM
PHP Version 7.2.3 - fseek – #78850
 
10:21 AM
@Levi
krakjoe@fiji:/opt/src/zi$ cat test.php
<?php
function foo($a) {
    if ($a) {
        return "hello";
    }

    return 2;
}

var_dump(foo(true));

krakjoe@fiji:/opt/src/zi$ php -dzend_extension=zi.so test.php
started 0x7fb780c0e0f0 ZEND_JMPZ @ 0x7fb780c84420
exit 0x7fb780c0e0f0 ZEND_RETURN @ 0x7fb780c84440
string(5) "hello"
I have to do other stuff now, but I'll find some more time, manage try/catch/finally/throw and then stick it on github for you to gawk at ...
<?php
function foo($a) {
    if ($a) {
        throw new Exception();
    }

    return 2;
}

var_dump(foo(true));
(gdb) r
Starting program: /opt/bin/php -n -dzend_extension=zi.so test.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
started 0x7ffff300e0f0 ZEND_JMPZ @ 0x7ffff3069520
exit 0x7ffff300e0f0 ZEND_THROW @ 0x7ffff3069580

Fatal error: Uncaught Exception in /opt/src/zi/test.php:4
Stack trace:
#0 /opt/src/zi/test.php(10): foo(true)
#1 {main}
  thrown in /opt/src/zi/test.php on line 4
[Inferior 1 (process 9570) exited with code 0377]
 
10:48 AM
@DaveRandom use cases for docker: a properly set up network namespace is much nicer than a ton of weird iptable routings
 
Normal that with ZPP "h!|l" doesn't work when I only provide null as a first argument?
 
cmb
11:21 AM
@Girgias, I think that should work, and assign C NULL to the first arg.
I'm trying to integrate the value of the user opcode handlers into OPcache's system ID hash.
That works nicely, if OPcache is loaded last, but not otherwise.
Would there be any sane of postponing OPcache startup until after all user opcode handlers have been installed?
 
xx@‌gmail.com – #78851
 
11:55 AM
preg_match() may return integer > 1 – #78853
 
12:09 PM
o/
 
cmb
12:21 PM
\o
 
Wes
12:33 PM
@Jeeves lol
 
12:43 PM
Hello Everyone
I have two tables (application and employee) that related with One to One, bi directional. In application table I have four attributes (

name_app, responsible_app, responsible_app_backup_1 and responsible_app_backup_2```)

and in employee table I have also three attributes (```uid_employee, first_name and last_name```). So how can I list out uid, first name and last name for each responsible_app?
Thanks
 
 
1 hour later…
2:06 PM
@cmb at uni currently but in the mean time I made it do a fresh compile with debug enabled because I was also getting another weird segfault
But will see if adding NULL as the base assignment fixes it
Because I'm doing 2 ZPP Quiet parse and it felt is was always not validating the checks
 
2:39 PM
Morning, lads.
 
mornin
 
4 of my many personalities are offended by "lads", and 1 of them wants to lick your face ... the rest are indifferent ...
 
lol
laddies?
 
o/
@amiega your question is rather confusing. what is the relationship between application and employee?
 
2:56 PM
@StatikStasis Are you implying he's Scottish now?
 
Depends on which of his personas I am talking to.
 
3:11 PM
Anyone else have any suggestions on my proposed RFC, or do I just throw myself to the wolves send it to Internals?
 
@Machavity looks good
 
cmb
@Machavity, I'm not sure that this would even need an RFC; it's just about adding a missing function. :)
 
@JoeWatkins Does JIT still use opcode handlers?
 
yes
 
I wish I knew more C or I'd write a patch myself
 
the core of the idea is I think how we should implement this in core, and we can probably do an okayish job in an extension too
so for 7 package zend instruments as a zend_extension, and hopefully merge it into 8
 
3:39 PM
@JoeWatkins ... then it seems kinda useless, doesn't it?
Isn't the point to get rid of the VM overhead?
 
I must have misunderstood the question
 
I'd be relying quite a bit on you if we took such an approach -- I don't think my current skills are good enough to try and land such a thing in time for PHP 8.
 
the jit injects machine code by overriding the handler for an opline
the jit will compile and call user opcodes (last time I checked it was still enabled, I requested it was enabled specifically early in the conversation)
you are overestimating how complicated this is
 
Maybe. How do I know which bits can throw?
I thought nearly everything could throw?
 
    zend_build_cfg(&arena, ops,  ZEND_RT_CONSTANTS, &cfg);

	for (block = cfg.blocks, i = 0; i < cfg.blocks_count; i++, block++) {
		opline = ops->opcodes + block->start;
		end = opline + block->len;

		if (!(block->flags & ZEND_BB_REACHABLE)) {
			continue;
		}

        if ((block->flags & ZEND_BB_START)) {
            while (opline->opcode == ZEND_RECV ||
                   opline->opcode == ZEND_RECV_INIT) {
                opline++;
            }

            /* you want the args after recv */
see, over estimation is an under-statement ... now obviously this isn't finished, and there is likely to be more complicated logic, but that's your starting place ... there are also blocks for try/catch/finally, should we want to handle them in some way
I think we ought to look at developing the instruments api along the lines of the api that the cfg provides
that gives us entry/exit, and potentially, begin/end try, begin/end catch, begin/end finally ... that should cover every possible use case, I think ...
thats a pretty dumb way of backing up the opline, not compatible with jit, but that's fixable ...
 
3:45 PM
What about function1 that calls function2 and function2 throws and function1 does not have try/finally at all?
 
well that's details ... details that I don't have figured out right now ...
 
At the beginning of each function, we need to begin instrumentation. So we could override the first opcode's handler to set that up to call the .begin points, and then do whatever the opcode was going to do. If we hook into the return opcodes we can deliver the .end points.
What's missing is exceptions. We could wrap the whole thing in a try-catch, where the catch just re-throws the exception, and we deliver the .error points there.
What do you think?
 
well not the first opcode, because that might be recv, but after prologue (which is what the code above does)
also, I posted an example of this handling the throw, it doesn't handle the recursion, but that's an implementation detail ... it's all pretty rough ideas still, but I have more and might have more time tomorrow ... I'll tinker another couple of days and see what comes out ...
 
@JoeWatkins Recursion?
 
sorry, nesting
I wrote it in 20 minutes to handle the simple cases I posted in here and haven't had more time to work on it during today, so it's still very basic ... but what it shows us is that the analysis we need to do in order to instrument code is already done by opcache, and we either need to reuse that in php-src, or export it out ...
I can think of four better ways to write it, in about 5 minutes ... I'm just seeing what is possible and how easy we can make it ...
 
4:42 PM
A good book on regular expressions
 
cmb
5:07 PM
Mastering Regular Expressions by Jeffrey E. F. Friedl
 
^ nice book.
 
user7659542
Hi
 
user7659542
I have an empty php script and it looks like the function
 
user7659542
new DOMDocument();
 
user7659542
never returns. How can I debug this to find out where the issue lies?
 
5:17 PM
Morngins
What does that mean "never returns"
 
user7659542
the debugger in the firefox browser doesnt tell much
 
It's not a function
It's creating a new instance of a domdoc
 
user7659542
echo "aa";
$foo = new DOMDocument();
echo "bb";
 
user7659542
bb never gets printed.
 
Enable error reporting
!!errors
 
5:18 PM
563
Q: How can I get useful error messages in PHP?

CandidasaQuite often I will try and run a PHP script and just get a blank screen back. No error message; just an empty screen. The cause might have been a simple syntax error (wrong bracket, missing semicolon), or a failed function call, or something else entirely. It is very difficult to figure out what...

 
@traducerad Constructors in PHP don't return anything. Case in point
 
does PHP have a specific function in the kitchen sink for testing if a string contains a null byte?
I mean, I can use strpos (and do so) but I wonder if.
 
user7659542
@PeeHaa Meh. Enabled it php.ini
 
user7659542
went to 127.0.0.1/cms.php in my browser
 
user7659542
first line of my script is missing a semicolon
 
user7659542
5:30 PM
and still no errors are reported anywhere
 
user7659542
changed display_errors to On
 
@hakre I thought null bytes were string terminators
 
cmb
@hakre, I don't think so. You could pass the string to any function expecting a path, and check whether it returns null, but I wouldn't recommend doing that.
@FélixGagnon-Grenier, no, PHP strings are binary safe (meaning they may contain NUL bytes)
 
user7659542
sudo apt install php-dom
 
user7659542
5:37 PM
didn t know php didnt have DOM by default
 
You didn't enable error reporting...
 
user7659542
@PeeHaa I did. I can now see the error being displayed
 
user7659542
Fatal error: Uncaught Error: Class 'DomDocument' not found in ...
 
good
 
@traducerad Most of the non-core stuff is compiled separately and has either a DLL or package
 
5:48 PM
@Machavity But new certainly does :-P
 
user7659542
@Trowski This.
 
new doesn't return anything though
 
user7659542
@PeeHaa not here, but it typically does.
 
No it doesn't
var_dump(new);
 
My point is that __construct() can never return anything. new just gives you an instance of the object
 
5:59 PM
... but then what returns the class instance if neither new nor __construct?
the combination of the two?
(s/class instance/whatever the "pointer" is called)
 
cmb
I'd say new is an operator, and new Foois an expression which evaluates to a class instance
 
Well, we can get philisophical. If a PHP constructor returns a value that is never passed back to the variable, does Javascript still make a sound?
 
it utters <sub>jQuery</sub> softly
 
6:29 PM
@PeeHaa You know I meant the statement new ClassName. __construct() is simply called by the engine when instigating the object, but its return value isn't used.
 
@cmb nice distinction, thanks
 
Yeah, essentially what cmb said.
 
@Trowski I just felt like being a pedantic ass :)
 
Well that I totally understand. :-D
 
@PeeHaa I am shocked, shocked I tell ya <3
 
6:31 PM
:P
 
user7659542
7:15 PM
the heck
 
user7659542
Warning: DOMDocument::load(): EntityRef: expecting ';' in /var/www/html/main.html, line: 94 in /var/www/html/cms.php on line 7
 
user7659542
this is line 94:
 
user7659542
<iframe width="600" height="500" id="gmap_canvas" src="https://maps.google.com/maps?q=centraal%20station%2C%20brussels%2C%20belgium&ampt=&ampz=13&ampie=UTF8&ampiwloc=&ampoutput=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">
 
user7659542
according to the html stdn only the ampersant has to be written as &amp
 
user7659542
what is the matter with that link?
 
user7659542
7:18 PM
line 7: if($dom->load("/var/www/html/main.html") == false)
 
Can you fopen that particular file?
 
user7659542
hmm, so you re supposed to write %26 and not &amp
 
user7659542
PHP is an intriguing language
 
user10141648
Hello,
Does someone know a good tutorial on how to make a good livesearch with ajax/php ?
I want to make one for my webshop and it needs to show output in a drop down
 
I'd just pay someone to do it TBH. I found a drop-in replacement when Google Custom Search ended
 
user10141648
7:27 PM
I know but it is for a school project and I can't use external things like frameworks/APIs etc.
 
user10141648
Needs to be something like this:
https://www.youtube.com/watch?v=mZOpvhywT_E
 
user10141648
But he uses an .json file to get data from
 
7:49 PM
@traducerad No. Your entities are wrong: &amp is not a thing
&amp; is
 
Guys please is there a reason why the function preg_match_all in php will work flawlessly on my local machine using xampp as server
but refuses to work when hosted
please any suggestion or advise will go a long way
 
8:23 PM
Is your host running the same version of PHP?
 
yes @Machavity
I have even contacted them and their response was yes and preg_match_all is a php core function which does not depend on versions
 
Are you using FTP to put files on the host server?
 
yes
@Machavity yes am using core ftp le for the upload
 
@NobMusic Are you using ASCII to transfer the files? If not, it could be mangling the regex when you upload it
 
@Machavity actually I don't know about that
how can i implement it ?
 
8:32 PM
There should be a setting somewhere to force it to use ASCII to transfer the file
 
@Machavity let me check, thanks alot
please is that the only thing you think can cause this issue ?
 
That's my bet. I'm not sure of anything else that would cause a working file to fail on a server
 
@Machavity I found the The ASCII under options->extensions and .php is among the list of file extensions there. should I remove it or what please
 
Take a look at the logs when it pushes the PHP. Make certain it says ASCII when it puts it up
 
8:51 PM
@Machavity boss here is the log
26 2 matches total
Transferred 131 bytes in 0.008 seconds
PWD
257 "/public_html" is your current location
TYPE A
200 TYPE is now ASCII
PASV
227 Entering Passive Mode
STOR class.instagram.php
Connect socket
150 Accepted data connection
226-File successfully transferred
226 0.140 seconds (measured here), 15.63 Kbytes per second
class.instagram.php - 2241 bytes transferred in 0 seconds
MDTM 20191121202753 class.app.php
550 Can't check for file existence
Transfer time: 00:00:02
 
Hmm. I'm out of ideas then
 
oh thanks for your help
 
9:08 PM
"Near shoutless puff of smoke" is my favourite ever description of a silent fart
@NobMusic can't check for existence suggests you do not have execute permission on the containing directory or one of its parents
meaning probably you have a directory with 644 instead of 755 or whatever, 6 instead of 7 anyway
May be a mlsconfugured chroot jail
 
ThW
@traducerad Not PHP, but HTML/XML vs URLs. & are encoded as &amp; in XML/HTML and %26in an URL. It depends on the context not the programming language.
 
Cba correcting that spelling mistake, on mobile
 
@DaveRandom are you suggesting I get a cloud hosting or dedicated hosting for the application ?
 
Yeh I didn't read up properly :-P
Check the PHP version on the server
Its not true to say there are no differences between versions
Like, if they are running PHP 5.3 or some crap...
/me is driving, bbiab
 
ThW
9:25 PM
@NobMusic Actually it depends on the PCRElib as well, so here can be differences even if it is the same PHP version. But this are true edge cases.
@NobMusic Have you tried the pattern against the different PHP versions on 3v4l.org
 
@ThW No I havn't
 
ThW
@NobMusic It is a good way to break the problem down - and to show it to us.
 
@Thw
I havnt use that before and I just tried it but didnt return any error
 
ThW
URL?
 
@ThW Do you mean the url to the site I hosted the application ?
 
ThW
9:40 PM
No, the URL to your 3v4l.org snippet.
 
@THw
I cant seems to get the url
cant find option like that there
 
ThW
9:57 PM
You can't find URL in the address bar of your browser?
 
@NobMusic how does that refuse look like? and is there a specific regex pattern involved that fails?
also what @ThW said, you can check the pcre lib version, it's a constant: PCRE_VERSION
 
@ThW here is it 3v4l.org/0o1UN
 
ThW
Your code does to many things at once.
The pattern is syntactically right, but conceptionally broken. /mp4/m just matches the sub string mp4
 
what is a good value for a maximum path length?
should I take 1024 or should I opt for 4096?
 
@ThW this parttern works on my local machine but didnt work after hosting could this be problem ?
and also am new into dev so some terms are kinda ambiguous to me lolz
 
10:13 PM
@cmb I now check for that. this was again a nice round-trip of bug-fixing, but I think I pretty well ironed out fatal errors due to NUL byte injection.
and for path length I go for 4096 for the moment.
 
ThW
@NobMusic don't think so - it matches the string mp4 and returns it, check what is in $story
The successful match makes no sense
3v4l.org/oNF2H the pattern only matches the string mp4 - not a file name.
And the result of a non-match would be just that it does not output a video tag, but a link
could be replaced with an strpos however 3v4l.org/CdfQH
 
11:00 PM
@JoeWatkins How do you replace the opcode handler for just that op array? I didn't understand this bit. My only idea was to use a different opcode, say ZEND_INSTRUMENT_RETURN instead of ZEND_RETURN.
 
11:16 PM
@cmb so I've tried that and it doesn't seem to work?
Also can someone explain me why (/how) I'm getting a segfault by throwing a Type Error ?
#0 0x000000000842b416 in zend_fetch_debug_backtrace (return_value=0x7ffffffea130, skip_last=0, options=0, limit=0) at /mnt/c/Dev/php-src/Zend/zend_builtin_functions.c:2232
#1 0x0000000008432a17 in zend_default_exception_new_ex (class_type=0x8c80130, skip_top_traces=0) at /mnt/c/Dev/php-src/Zend/zend_exceptions.c:218
#2 0x0000000008432ca9 in zend_default_exception_new (class_type=0x8c80130) at /mnt/c/Dev/php-src/Zend/zend_exceptions.c:249
#3 0x000000000840cbaa in _object_and_properties_init (arg=0x7ffffffea230, class_type=0x8c80130, properties=0x0) at /mnt/c/Dev/php-src/Zend/zend_API.c:1258
 

« first day (3323 days earlier)      last day (1618 days later) »