Re: RFC: Catchable "call to a member function of a non-object"
Hi Johannes,
> The definition of E_ERROR is "an error where the engine can't fully
> recover", so if we can recover there should be no need for a vote ;-)
:)
> But I have doubts whether this works reliably in all cases where
> functions are called. i.e. how will usort() behave?
You're right, there's not test for this. I've added two phpt-files
showing this does not corrupt eval() or calls inside usort():
https://github.com/thekid/php-src/commit/da1db5e688c46a044bc0745c86cc34cc4e9ab808
https://github.com/thekid/php-src/commit/7041ef44a6c18bb8d76dc5cf17d20ec00367d24b
> From a very quick grep it seems that i.e. sapi/phpdbg doesn't check the
> return value of zend_call_function, these things have to be reviewed too.
Good point! Looking into the details of my implementation again though,
this cannot lead to a problem AFAIS, zend_call_function() will return
cleanly in any case. I'm not firm with sapi/phpdbg's usage, could you point
to where you think I'd start seeing a problem?
What I've tried so far is:
$ cat dbg.php
<?php
set_error_handler(function($code, $message) {
var_dump($code, $message);
}, E_RECOVERABLE_ERROR);
$comparator= null;
var_dump($comparator->compare(1, 2));
echo "Alive\n";
$ ./sapi/phpdbg/phpdbg
[Welcome to phpdbg, the interactive PHP debugger, v0.3.2]
To get help using phpdbg type "help" and press enter
[Please report bugs to <http://github.com/krakjoe/phpdbg/issues>]
phpdbg> exec dbg.php
[Set execution context: /home/friebe/devel/php-src/dbg.php]
phpdbg> compile
[Attempting compilation of /home/friebe/devel/php-src/dbg.php]
[Success]
phpdbg> run
int(4096)
string(51) "Call to a member function compare() on a non-object"
NULL
Alive
phpdbg>
...and also "step 1" and the "next"ing through the code, without any surprises.
- Timm
Thread (11 messages)