. Fixed bug #73585 (Logging of "Internal Zend error - Missing class
information" missing class name). (Laruence)
+- PCRE:
+ . Fixed bug #73612 (preg_*() may leak memory). (cmb)
+
08 Dec 2016 PHP 7.0.14
- Core:
/* Overwrite the passed-in value for subpatterns with an empty array. */
if (subpats != NULL) {
- zval_dtor(subpats);
+ zval_ptr_dtor(subpats);
array_init(subpats);
}
replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 0, 0);
if (zcount) {
- zval_dtor(zcount);
+ zval_ptr_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}
}
replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 1, 0);
if (zcount) {
- zval_dtor(zcount);
+ zval_ptr_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}
}
} ZEND_HASH_FOREACH_END();
if (zcount) {
- zval_dtor(zcount);
+ zval_ptr_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}
}
replace_count = preg_replace_impl(return_value, regex, replace, subject, limit, 0, 1);
if (zcount) {
- zval_dtor(zcount);
+ zval_ptr_dtor(zcount);
ZVAL_LONG(zcount, replace_count);
}
}
--- /dev/null
+--TEST--\r
+Bug #73612 (preg_*() may leak memory)\r
+--FILE--\r
+<?php\r
+$obj = new stdClass;\r
+$obj->obj = $obj;\r
+preg_match('/./', 'x', $obj);\r
+\r
+$obj = new stdClass;\r
+$obj->obj = $obj;\r
+preg_replace('/./', '', 'x', -1, $obj);\r
+\r
+$obj = new stdClass;\r
+$obj->obj = $obj;\r
+preg_replace_callback('/./', 'count', 'x', -1, $obj);\r
+\r
+$obj = new stdClass;\r
+$obj->obj = $obj;\r
+preg_replace_callback_array(['/./' => 'count'], 'x', -1, $obj);\r
+\r
+$obj = new stdClass;\r
+$obj->obj = $obj;\r
+preg_filter('/./', '', 'x', -1, $obj);\r
+?>\r
+===DONE===\r
+--EXPECT--\r
+===DONE===\r