]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0' into PHP-7.1
authorXinchen Hui <laruence@gmail.com>
Sat, 22 Oct 2016 06:50:42 +0000 (14:50 +0800)
committerXinchen Hui <laruence@gmail.com>
Sat, 22 Oct 2016 06:50:42 +0000 (14:50 +0800)
* PHP-7.0:
  Fixed bug #73350 (Exception::__toString() cause circular references)

1  2 
Zend/zend_exceptions.c

index 331213d8e644b6b139d5f9aba9465749fdf62a4f,e0aa370bfe02f54d7223ceca56b709035d3be7ba..8f41e1ce71391420d07494c4185fc06b9d3466fa
@@@ -738,16 -774,17 +738,17 @@@ ZEND_METHOD(exception, __toString
                zval_ptr_dtor(&trace);
  
                Z_OBJPROP_P(exception)->u.v.nApplyCount++;
 -              exception = GET_PROPERTY(exception, "previous");
 +              exception = GET_PROPERTY(exception, ZEND_STR_PREVIOUS);
                if (exception && Z_TYPE_P(exception) == IS_OBJECT && Z_OBJPROP_P(exception)->u.v.nApplyCount > 0) {
-                       exception = NULL;
+                       break;
                }
        }
 -      zval_dtor(&fname);
 +      zend_string_release(fname);
  
+       exception = getThis();
        /* Reset apply counts */
        while (exception && Z_TYPE_P(exception) == IS_OBJECT && (base_ce = i_get_exception_base(exception)) && instanceof_function(Z_OBJCE_P(exception), base_ce)) {
-               if(Z_OBJPROP_P(exception)->u.v.nApplyCount) {
+               if (Z_OBJPROP_P(exception)->u.v.nApplyCount) {
                        Z_OBJPROP_P(exception)->u.v.nApplyCount--;
                } else {
                        break;