ID: 26962 Comment by: Maik_Heller at hotmail dot com Reported By: alex_mailbox53 at yahoo dot com Status: No Feedback Bug Type: Zend Engine 2 problem Operating System: Gentoo Linux PHP Version: 5.0.0b3 (beta3) New Comment:
problem still exists even with lates build (for win) Previous Comments: ------------------------------------------------------------------------ [2004-01-24 23:59:56] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2004-01-19 13:07:05] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2004-01-19 05:01:43] alex_mailbox53 at yahoo dot com Description: ------------ The ZEND_CHANGES defines that __toString method whould be called whenever object is casted to sting. But actually it is casted to string only during print (echo) operator. Even the example in ZEND_CHANGES does not work: class Foo { function __toString() { return "What ever"; } $obj = Foo; $str = (string) $obj; // call __toString() echo $obj; // call __toString() print $str will print the "Object" sring, not the "What ever". One more code example: class Integer { private $value; function __construct($val) { $this->value = $val; } function __toString() { return (string)($this->value); } } $i = new Integer(10); if (10 == $i) echo '10!!!! :-)'; "10!!! :-)" is not printed. Expected result: ---------------- When object is accessed in expressions it should be explicitly casted to sting nor vartype. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26962&edit=1