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
Hello su1d,
due to many problems we disabled that feature for now. We may reenable it
for PHP 5.1 if we find a way to solve all related engine problems.
marcus
Monday, March 22, 2004, 12:30:48 PM, you wrote:
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.