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/bug28444.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/bug28444.phpt')
-rw-r--r-- | Zend/tests/bug28444.phpt | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Zend/tests/bug28444.phpt b/Zend/tests/bug28444.phpt index b7e863da92..464aaef4c7 100644 --- a/Zend/tests/bug28444.phpt +++ b/Zend/tests/bug28444.phpt @@ -3,12 +3,6 @@ Bug #28444 (Cannot access undefined property for object with overloaded property --FILE-- <?php -function my_error_handler($errno, $errstr, $errfile, $errline) { - var_dump($errstr); -} - -set_error_handler('my_error_handler'); - class ObjectOne { public $x; @@ -17,6 +11,10 @@ class ObjectOne { $this->x = $x; } + + function __toString() { + return "Object"; + } } class Overloaded @@ -55,8 +53,8 @@ var_dump($y->z->x = 6); ?> ===DONE=== ---EXPECTF-- -object(ObjectOne)#%d (1) { +--EXPECT-- +object(ObjectOne)#2 (1) { ["x"]=> int(2) } @@ -66,9 +64,8 @@ Overloaded::__set(y,3) int(3) Overloaded::__get(y) int(3) -string(58) "Object of class ObjectOne could not be converted to string" -Overloaded::__set(z,) -object(ObjectOne)#%d (1) { +Overloaded::__set(z,Object) +object(ObjectOne)#3 (1) { ["x"]=> int(4) } |