php/php-src — pull request #157 by leight (2012-08-10 10:13:52+00:00)
Title: Bug #62328 (implementing __toString and a cast to string fails)

https://bugs.php.net/bug.php?id=62328

When extending a built-in class that has a cast_object function, and specifying a __toString method, the __toString method is ignored.

I have added a check to see if the object implements a __toString magic method, and call it when it does, leaving the check for cast_object as the next thing to check.

No new tests are failing with this change.