tony2001 Wed Aug 30 10:41:43 2006 UTC Added files: /php-src/ext/reflection/tests bug38653.phpt
Modified files: /php-src/ext/reflection php_reflection.c Log: fix #38653 (memory leak in ReflectionClass::getConstant()) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.249&r2=1.250&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.249 php-src/ext/reflection/php_reflection.c:1.250 --- php-src/ext/reflection/php_reflection.c:1.249 Thu Jul 27 09:19:25 2006 +++ php-src/ext/reflection/php_reflection.c Wed Aug 30 10:41:43 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $ */ +/* $Id: php_reflection.c,v 1.250 2006/08/30 10:41:43 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -206,6 +206,7 @@ *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 @@ } *return_value = **value; zval_copy_ctor(return_value); + INIT_PZVAL(return_value); } /* }}} */ @@ -4865,7 +4867,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.249 2006/07/27 09:19:25 dmitry Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.250 2006/08/30 10:41:43 tony2001 Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38653.phpt?view=markup&rev=1.1 Index: php-src/ext/reflection/tests/bug38653.phpt +++ php-src/ext/reflection/tests/bug38653.phpt --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 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php