tony2001                Wed Aug 30 10:42:50 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/reflection/tests       bug38653.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/reflection     php_reflection.c 
  Log:
  MFH: fix #38653 (memory leak in ReflectionClass::getConstant())
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.225&r2=1.2027.2.547.2.226&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.225 php-src/NEWS:1.2027.2.547.2.226
--- php-src/NEWS:1.2027.2.547.2.225     Tue Aug 29 17:10:40 2006
+++ php-src/NEWS        Wed Aug 30 10:42:49 2006
@@ -5,6 +5,7 @@
   SoapServer::setClass() method). (Dmitry)
 - Added support for hexadecimal entity in imagettftext() for the bundled GD.
   (Pierre)
+- Fixed bug #38653 (memory leak in ReflectionClass::getConstant()). (Tony)
 - Fixed bug #38637 (curl_copy_handle() fails to fully copy the cURL handle).
   (Tony, Ilia)
 - Fixed bug #38624 (Strange warning when incrementing an object property and 
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.19&r2=1.164.2.33.2.20&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.19 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.20
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.19     Wed Jul 26 
23:18:41 2006
+++ php-src/ext/reflection/php_reflection.c     Wed Aug 30 10:42:49 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.19 2006/07/26 23:18:41 iliaa Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.20 2006/08/30 10:42:49 tony2001 Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -211,6 +211,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)
@@ -3224,6 +3225,7 @@
        }
        *return_value = **value;
        zval_copy_ctor(return_value);
+       INIT_PZVAL(return_value);
 }
 /* }}} */
 
@@ -4794,7 +4796,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.164.2.33.2.19 2006/07/26 23:18:41 iliaa Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.33.2.20 2006/08/30 10:42:49 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

Reply via email to