diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-26 15:32:18 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-05 14:25:07 +0200 |
commit | a31f46421d7bf6f55dd9ac5876b8e2eacf7e0708 (patch) | |
tree | 24ffd7c5ae5e321c3994048fdd0fd9f68ae7457c /Zend/tests/call_with_refs.phpt | |
parent | 528aa7932a839fc6319979c34aa372805d8dc41c (diff) | |
download | php-git-a31f46421d7bf6f55dd9ac5876b8e2eacf7e0708.tar.gz |
Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions
And convert some object to string conversion related recoverable
fatal errors into Error exceptions.
Improve exception safety of internal code performing string
conversions.
Diffstat (limited to 'Zend/tests/call_with_refs.phpt')
-rw-r--r-- | Zend/tests/call_with_refs.phpt | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Zend/tests/call_with_refs.phpt b/Zend/tests/call_with_refs.phpt index f7b18365b4..0e01779a21 100644 --- a/Zend/tests/call_with_refs.phpt +++ b/Zend/tests/call_with_refs.phpt @@ -2,16 +2,17 @@ Check call to non-ref function with call-time refs --FILE-- <?php -function my_errorhandler($errno,$errormsg) { - global $my_var; - $my_var=0x12345; - echo $errormsg."\n"; - return true; +class Test { + public function __toString() { + global $my_var; + $my_var=0x12345; + return ""; + } } -$oldhandler = set_error_handler("my_errorhandler"); + $my_var = str_repeat("A",64); -$data = call_user_func_array("substr_replace",array(&$my_var, new StdClass(),1)); +$data = call_user_func_array("substr_replace",array(&$my_var, new Test(), 1)); echo "OK!"; +?> --EXPECT-- -Object of class stdClass could not be converted to string OK! |