Merge branch 'PHP-7.1'

This commit is contained in:
Nikita Popov 2016-12-18 17:11:01 +01:00
commit ca682952e7
2 changed files with 28 additions and 0 deletions

View File

@ -348,6 +348,15 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
}
/* }}} */
static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
reflection_object *intern = Z_REFLECTION_P(obj);
*gc_data = &intern->obj;
*gc_data_count = 1;
return zend_std_get_properties(obj);
}
/* }}} */
static zend_object *reflection_objects_new(zend_class_entry *class_type) /* {{{ */
{
reflection_object *intern;
@ -6802,6 +6811,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
reflection_object_handlers.free_obj = reflection_free_objects_storage;
reflection_object_handlers.clone_obj = NULL;
reflection_object_handlers.write_property = _reflection_write_property;
reflection_object_handlers.get_gc = reflection_get_gc;
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_ce_exception);

View File

@ -0,0 +1,18 @@
--TEST--
Bug #46103: ReflectionObject memory leak
--FILE--
<?php
$obj = new stdClass;
$obj->r = new ReflectionObject($obj);
var_dump($obj);
?>
--EXPECT--
object(stdClass)#1 (1) {
["r"]=>
object(ReflectionObject)#2 (1) {
["name"]=>
string(8) "stdClass"
}
}