#45387 [NEW]: (string)$obj on objects w/o __toString() behaves differently

From: Date: Sat, 28 Jun 2008 17:42:45 +0000
Subject: #45387 [NEW]: (string)$obj on objects w/o __toString() behaves differently
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126092@lists.php.net to get a copy of this message
From: tswicegood@php.net Operating system: OS X PHP version: 5.3CVS-2008-06-28 (CVS) PHP Bug Type: *General Issues Bug description: (string)$obj on objects w/o __toString() behaves differently Description: ------------ In PHP 5.2.x calling (string)$object on an object w/o the __toString() method would cause a catchable fatal error and would halt execution. In PHP 5.3, the error is thrown but execution continues. This is the same behavior as PHP 5.1.4 - 5.1.6 (may be true for older versions as well, but I only tested back to 5.1.4). Reproduce code: --------------- <?php $o = new StdClass(); @(string)$o; echo "OK"; Expected result: ---------------- Unsure - possibly OK, possibly nothing. I'm not sure if 5.2.x or 5.1/5.3 behavior is correct. Actual result: -------------- OK -- Edit bug report at http://bugs.php.net/?id=45387&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45387&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45387&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45387&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45387&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45387&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45387&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45387&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45387&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45387&r=support Expected behavior: http://bugs.php.net/fix.php?id=45387&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45387&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45387&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45387&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45387&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45387&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45387&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45387&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45387&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45387&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45387&r=mysqlcfg

« previous php.bugs (#126092) next »