From:             lphuberdeau at phpquebec dot org
Operating system: Linux
PHP version:      5CVS-2003-11-07 (dev)
PHP Bug Type:     Reproducible crash
Bug description:  __toString() crash when no values returned

Description:
------------
It's actually the same bug as before with __get() not returning any value.
__toString() simply crashed when you throw an exception inside.

There is an other problem with __toString(). If you call an other
__toString() method from an other object to return it, the value is not
considered as a string.

The version I tested on is actually the one from yesterday.

Reproduce code:
---------------
class Foo
{
    function __toString()
    {
        return "Hello World!";
    }
}

class Bar
{
    private $obj;

    function __construct()
    {
        $this->obj = new Foo();
    }

    function __toString()
    {
        return $this->obj->__toString();
    }
}

$o = new Bar();
echo $o;


-- 
Edit bug report at http://bugs.php.net/?id=26166&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26166&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26166&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26166&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26166&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26166&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26166&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26166&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26166&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26166&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26166&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26166&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26166&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26166&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26166&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26166&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26166&r=float

Reply via email to