https://bugs.php.net/bug.php?id=62328
Added a check to see if the object implements a __toString magic
method. This should be called instead of the cast_object method of
built-in classes when defined.
{
TSRMLS_FETCH();
+ if (Z_OBJCE_P(expr)->__tostring) {
+ if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
+ break;
+ }
+ }
+
if (Z_OBJ_HANDLER_P(expr, cast_object)) {
zval *val;