From:             marcos dot neves at gmail dot com
Operating system: ANY
PHP version:      5.2.0
PHP Bug Type:     Feature/Change Request
Bug description:  __toString back compatibility

Description:
------------
Object that do not implement __toString, now stop the script with "PHP
Catchable fatal error:  Object of class {className} could not be converted
to string in ..."

But for backward compatibility, if __toString is not  implemented, it
should return the old object id value, or the name of class of the object
for example.

I agree that nobody can rely on old ObjectId string, but there“s thousand
scripts that stringfy data for logging,
like this:

function log($vars)
{
foreach($vars as $var) echo $var;
}

function test($a, $b)
{
    log(func_get_args());
}

Reproduce code:
---------------
class Foo { }
echo new Foo;

Expected result:
----------------
Old behavior of conversion from object to string

Actual result:
--------------
Catchable fatal error: Object of class Foo could not be converted to
string in ...

-- 
Edit bug report at http://bugs.php.net/?id=39392&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39392&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39392&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39392&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39392&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39392&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39392&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39392&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39392&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39392&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39392&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39392&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39392&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39392&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39392&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39392&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39392&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39392&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39392&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39392&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39392&r=mysqlcfg

Reply via email to