mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix bug #46103
This commit is contained in:
parent
eb636fcb56
commit
c1af9f282f
3 changed files with 32 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -32,6 +32,10 @@ PHP NEWS
|
||||||
(Bob)
|
(Bob)
|
||||||
. Fixed issue getting executable lines from custom wrappers. (Bob)
|
. Fixed issue getting executable lines from custom wrappers. (Bob)
|
||||||
|
|
||||||
|
- Reflection:
|
||||||
|
. Fixed bug #46103 (ReflectionObject memory leak). (Nikita)
|
||||||
|
|
||||||
|
|
||||||
08 Dec 2016 PHP 7.0.14
|
08 Dec 2016 PHP 7.0.14
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
|
|
@ -344,6 +344,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) /* {{{ */
|
static zend_object *reflection_objects_new(zend_class_entry *class_type) /* {{{ */
|
||||||
{
|
{
|
||||||
reflection_object *intern;
|
reflection_object *intern;
|
||||||
|
@ -6524,6 +6533,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
|
||||||
reflection_object_handlers.free_obj = reflection_free_objects_storage;
|
reflection_object_handlers.free_obj = reflection_free_objects_storage;
|
||||||
reflection_object_handlers.clone_obj = NULL;
|
reflection_object_handlers.clone_obj = NULL;
|
||||||
reflection_object_handlers.write_property = _reflection_write_property;
|
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);
|
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionException", reflection_exception_functions);
|
||||||
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_ce_exception);
|
reflection_exception_ptr = zend_register_internal_class_ex(&_reflection_entry, zend_ce_exception);
|
||||||
|
|
18
ext/reflection/tests/bug46103.phpt
Normal file
18
ext/reflection/tests/bug46103.phpt
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue