5.0.0RC1: __toString() problem

From: Date: Mon, 22 Mar 2004 11:30:48 +0000
Subject: 5.0.0RC1: __toString() problem
Groups: php.internals 
Request: Send a blank email to internals+get-8648@lists.php.net to get a copy of this message
Hi! It seems like __toString() method is not called as it is announced on http://www.php.net/zend-engine-2.php The only working case is when you pass an object to echo(). Unfortunately, I couldn't check out the bugs DB, because there's no access to bugs.php.net from my ISP. So, I'm awfully sorry if you're aware of this issue already, and/or this all has been discussed before. in plain English: --TEST-- PHP5 __toString() method --FILE-- <?php class A { function __toString() { return "ABC"; } } $a = new A(); $b = (string)$a; echo $a; echo "\n"; echo "".$a."\n"; echo $b."\n"; ?> --EXPECT-- ABC ABC ABC the test outputs: ABC Object id #1 Object id #1

« previous php.internals (#8648) next »