cvs: php-src /tests/classes tostring_001.phpt

From: Date: Thu, 06 Oct 2005 18:37:21 +0000
Subject: cvs: php-src /tests/classes tostring_001.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-34354@lists.php.net to get a copy of this message
helly Thu Oct 6 14:37:21 2005 EDT Modified files: /php-src/tests/classes tostring_001.phpt Log: - Fix test http://cvs.php.net/diff.php/php-src/tests/classes/tostring_001.phpt?r1=1.2&r2=1.3&ty=u Index: php-src/tests/classes/tostring_001.phpt diff -u php-src/tests/classes/tostring_001.phpt:1.2 php-src/tests/classes/tostring_001.phpt:1.3 --- php-src/tests/classes/tostring_001.phpt:1.2 Tue Sep 27 04:46:53 2005 +++ php-src/tests/classes/tostring_001.phpt Thu Oct 6 14:37:19 2005 @@ -5,16 +5,33 @@ --FILE-- <?php -class test1 { +function my_error_handler($errno, $errstr, $errfile, $errline) { + var_dump($errstr); } -class test2 { - function __toString() { +set_error_handler('my_error_handler'); + +class test1 +{ +} + +class test2 +{ + function __toString() + { echo __METHOD__ . "()\n"; return "Converted\n"; } } +class test3 +{ + function __toString() + { + echo __METHOD__ . "()\n"; + return 42; + } +} echo "====test1====\n"; $o = new test1; print_r($o); @@ -34,11 +51,11 @@ echo "====test5====\n"; echo 1 . $o; -echo 1 . $o; +echo 1 , $o; echo "====test6====\n"; -echo $o.$o; -echo $o,$o; +echo $o . $o; +echo $o , $o; echo "====test7====\n"; $ar = array(); @@ -51,14 +68,21 @@ echo "====test9====\n"; echo sprintf("%s", $o); + +echo "====test10====\n"; +$o = new test3; +var_dump($o); +echo $o; + ?> -====DONE!==== +====DONE==== --EXPECTF-- ====test1==== test1 Object ( ) -string(12) "Object id #%d" +string(54) "Object of class test1 could not be converted to string" +string(0) "" object(test1)#%d (0) { } ====test2==== @@ -67,7 +91,7 @@ ) test2::__toString() Converted -object(test2)#%d (%d) { +object(test2)#%d (0) { } ====test3==== test2::__toString() @@ -78,8 +102,8 @@ ====test5==== test2::__toString() 1Converted -test2::__toString() -1Converted +1test2::__toString() +Converted ====test6==== test2::__toString() test2::__toString() @@ -91,8 +115,7 @@ Converted ====test7==== test2::__toString() - -Warning: Illegal offset type in %stostring_001.php on line %d +string(19) "Illegal offset type" ====test8==== test2::__toString() string(9) "Converted" @@ -101,53 +124,9 @@ ====test9==== test2::__toString() Converted -====DONE!==== ---UEXPECTF-- -====test1==== -test1 Object -( -) -string(12) "Object id #%d" -object(test1)#%d (0) { -} -====test2==== -test2 Object -( -) -test2::__toString() -Converted -object(test2)#%d (%d) { +====test10==== +object(test3)#%d (0) { } -====test3==== -test2::__toString() -Converted -====test4==== -test2::__toString() -string:Converted -====test5==== -test2::__toString() -1Converted -test2::__toString() -1Converted -====test6==== -test2::__toString() -test2::__toString() -Converted -Converted -test2::__toString() -Converted -test2::__toString() -Converted -====test7==== -test2::__toString() - -Warning: Illegal offset type in %stostring_001.php on line %d -====test8==== -test2::__toString() -unicode(9) "Converted" -test2::__toString() -unicode(9) "Converted" -====test9==== -test2::__toString() -Converted -====DONE!==== +test3::__toString() +string(53) "Method test3::__toString() must return a string value" +====DONE====

« previous php.cvs (#34354) next »