summaryrefslogtreecommitdiff
path: root/tests/classes/tostring_004.phpt
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-05 14:38:01 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-05 14:53:50 +0200
commit7686b0b88906e2522300b9e631ddde2051de839f (patch)
tree31a3cfd1feaf6f7190bad8222a6f9da567acd723 /tests/classes/tostring_004.phpt
parent03a9c2df7baea96a4777346c8799f0a6fdd7c882 (diff)
parenta31f46421d7bf6f55dd9ac5876b8e2eacf7e0708 (diff)
downloadphp-git-7686b0b88906e2522300b9e631ddde2051de839f.tar.gz
Merge branch 'PHP-7.4'
Diffstat (limited to 'tests/classes/tostring_004.phpt')
-rw-r--r--tests/classes/tostring_004.phpt37
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/classes/tostring_004.phpt b/tests/classes/tostring_004.phpt
index 6029938f32..997f2e2e7f 100644
--- a/tests/classes/tostring_004.phpt
+++ b/tests/classes/tostring_004.phpt
@@ -12,12 +12,19 @@ error_reporting(8191);
echo "Object with no __toString():\n";
$obj = new stdClass;
echo "Try 1:\n";
-printf($obj);
+try {
+ printf($obj);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
printf("\n");
echo "\nTry 2:\n";
-printf($obj . "\n");
-
+try {
+ printf($obj . "\n");
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n\nObject with bad __toString():\n";
class badToString {
@@ -25,30 +32,38 @@ class badToString {
return 0;
}
}
+
$obj = new badToString;
echo "Try 1:\n";
-printf($obj);
+try {
+ printf($obj);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
printf("\n");
echo "\nTry 2:\n";
-printf($obj . "\n");
+try {
+ printf($obj . "\n");
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECT--
Object with no __toString():
Try 1:
-Error: 4096 - Object of class stdClass could not be converted to string
-Object
+Object of class stdClass could not be converted to string
-Try 2:
-Error: 4096 - Object of class stdClass could not be converted to string
+Try 2:
+Object of class stdClass could not be converted to string
Object with bad __toString():
Try 1:
-Error: 4096 - Method badToString::__toString() must return a string value
+Method badToString::__toString() must return a string value
Try 2:
-Error: 4096 - Method badToString::__toString() must return a string value
+Method badToString::__toString() must return a string value