Re: __toString()

php.internals

Marcus Börger

22 years ago
Hello Sebastian, Sunday, December 14, 2003, 8:56:15 AM, you wrote:
> The following code from PHPUnit stopped working after the recent changes > to __toString()
> protected function printDefectTrace(PHPUnit_Framework_TestFailure > $defect) { > print $defect->thrownException() . "\n";
> print PHPUnit_Runner_BaseTestRunner::getFilteredStack( > $defect->thrownException() > ); > }
> The
> print $defect->thrownException() . "\n";
> line worked fine before and printed the result of
> $defect->thrownException()->__toString()
> Is this the intended behaviour?
Yes. We found out that calling __toString() automatically in any place in the executor has unsolveable problems right now (ask Andi for details).
-- Best regards, Marcus mailto:helly@php.net

Sebastian Bergmann

22 years ago
Marcus Boerger wrote:
> We found out that calling __toString() automatically in any place in > the executor has unsolveable problems right now (ask Andi for details).
So if __toString() is no longer automatically called what is its purpose then? I mean, if I have to explicitly call it via ->__toString() I can save two characters and name the method toString().
-- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/

Marcus Börger

22 years ago
Hello Sebastian, Sunday, December 14, 2003, 1:52:38 PM, you wrote:
> Marcus Boerger wrote: >> We found out that calling __toString() automatically in any place in >> the executor has unsolveable problems right now (ask Andi for details).
> So if __toString() is no longer automatically called what is its > purpose then?
> I mean, if I have to explicitly call it via ->__toString() I can save > two characters and name the method toString().
Probably someone takes a deeper look into all problems after 5.0 is out? i don't know. Anyway it is a naming convention.
-- Best regards, Marcus mailto:helly@php.net