1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 10:43:30 +02:00

fix #38653 (memory leak in ReflectionClass::getConstant())

This commit is contained in:
Antony Dovgal
2006-08-30 10:41:43 +00:00
parent 33ad684e86
commit dcbbae86eb
2 changed files with 36 additions and 0 deletions
+2
View File
@@ -206,6 +206,7 @@ static void _default_get_entry(zval *object, char *name, int name_len, zval *ret
*return_value = **value;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
static void reflection_register_implement(zend_class_entry *class_entry, zend_class_entry *interface_entry TSRMLS_DC)
@@ -3261,6 +3262,7 @@ ZEND_METHOD(reflection_class, getConstant)
}
*return_value = **value;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
/* }}} */
+34
View File
@@ -0,0 +1,34 @@
--TEST--
Bug #38653 (memory leak in ReflectionClass::getConstant())
--FILE--
<?php
class foo {
const cons = 10;
const cons1 = "";
const cons2 = "test";
}
class bar extends foo {
}
$foo = new ReflectionClass("foo");
var_dump($foo->getConstant("cons"));
var_dump($foo->getConstant("cons1"));
var_dump($foo->getConstant("cons2"));
var_dump($foo->getConstant("no such const"));
echo "Done\n";
?>
--EXPECTF--
int(10)
string(0) ""
string(4) "test"
bool(false)
Done
--UEXPECTF--
int(10)
unicode(0) ""
unicode(4) "test"
bool(false)
Done