svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/reflection/php_reflection.c branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
branches/PHP_5_3/NEWS branches/PHP_5_3/ext/reflection/php_reflection.c branches/PHP_5_3/ext/reflection/tests/bug51911.phpt
trunk/ext/reflection/php_reflection.c trunk/ext/reflection/tests/bug51911.phpt
| From: | Felipe Pena | Date: | Tue, 25 May 2010 22:46:17 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/reflection/php_reflection.c branches/PHP_5_2/ext/reflection/tests/bug51911.phpt branches/PHP_5_3/NEWS branches/PHP_5_3/ext/reflection/php_reflection.c branches/PHP_5_3/ext/reflection/tests/bug51911.phpt trunk/ext/reflection/php_reflection.c trunk/ext/reflection/tests/bug51911.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-62716@lists.php.net to get a copy of this message | ||
felipe Tue, 25 May 2010 22:46:17 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=299763
Log:
- Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with constant array)
Bug: http://bugs.php.net/51911 (Closed)
ReflectionParameter::getDefaultValue() memory leaks with constant array
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c
A php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
A php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt
U php/php-src/trunk/ext/reflection/php_reflection.c
A php/php-src/trunk/ext/reflection/tests/bug51911.phpt
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/branches/PHP_5_2/NEWS 2010-05-25 22:46:17 UTC (rev 299763)
@@ -18,6 +18,8 @@
- Fixed a possible arbitrary memory access inside sqlite extension. Reported
by Mateusz Kocielski. (Ilia)
+- Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with
+ constant array). (Felipe)
- Fixed bug #51671 (imagefill does not work correctly for small images).
(Pierre)
- Fixed bug #51670 (getColumnMeta causes segfault when re-executing query
Modified: php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c 2010-05-25 22:42:25 UTC (rev
299762)
+++ php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c 2010-05-25 22:46:17 UTC (rev
299763)
@@ -2170,7 +2170,7 @@
*return_value = precv->op2.u.constant;
INIT_PZVAL(return_value);
- if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+ if (Z_TYPE_P(return_value) != IS_CONSTANT && Z_TYPE_P(return_value) != IS_CONSTANT_ARRAY)
{
zval_copy_ctor(return_value);
}
zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
Added: php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
===================================================================
--- php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt (rev 0)
+++ php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt 2010-05-25 22:46:17 UTC (rev
299763)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with constant array)
+--FILE--
+<?php
+
+class Foo {
+ const X = 1;
+ public function x($x = array(1)) {}
+}
+
+$clazz = new ReflectionClass('Foo');
+$method = $clazz->getMethod('x');
+foreach ($method->getParameters() as $param) {
+ if ( $param->isDefaultValueAvailable())
+ echo '$', $param->getName(), ' : ',
var_export($param->getDefaultValue(), 1), "\n";
+}
+
+?>
+--EXPECT--
+$x : array (
+ 0 => 1,
+)
Property changes on: php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-05-25 22:46:17 UTC (rev 299763)
@@ -62,6 +62,8 @@
requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
- Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas)
+- Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with
+ constant array). (Felipe)
- Fixed bug #51844 (checkdnsrr does not support types other than MX). (Pierre)
- Fixed bug #51827 (Bad warning when register_shutdown_function called with
wrong num of parameters). (Felipe)
Modified: php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c 2010-05-25 22:42:25 UTC (rev
299762)
+++ php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c 2010-05-25 22:46:17 UTC (rev
299763)
@@ -2408,7 +2408,7 @@
*return_value = precv->op2.u.constant;
INIT_PZVAL(return_value);
- if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+ if (Z_TYPE_P(return_value) != IS_CONSTANT && Z_TYPE_P(return_value) != IS_CONSTANT_ARRAY)
{
zval_copy_ctor(return_value);
}
zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
Added: php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt 2010-05-25 22:46:17 UTC (rev
299763)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with constant array)
+--FILE--
+<?php
+
+class Foo {
+ const X = 1;
+ public function x($x = array(1)) {}
+}
+
+$clazz = new ReflectionClass('Foo');
+$method = $clazz->getMethod('x');
+foreach ($method->getParameters() as $param) {
+ if ( $param->isDefaultValueAvailable())
+ echo '$', $param->getName(), ' : ',
var_export($param->getDefaultValue(), 1), "\n";
+}
+
+?>
+--EXPECT--
+$x : array (
+ 0 => 1,
+)
Property changes on: php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c 2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/trunk/ext/reflection/php_reflection.c 2010-05-25 22:46:17 UTC (rev 299763)
@@ -2567,7 +2567,7 @@
*return_value = *precv->op2.zv;
INIT_PZVAL(return_value);
- if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+ if (Z_TYPE_P(return_value) != IS_CONSTANT && Z_TYPE_P(return_value) != IS_CONSTANT_ARRAY)
{
zval_copy_ctor(return_value);
}
zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
Added: php/php-src/trunk/ext/reflection/tests/bug51911.phpt
===================================================================
--- php/php-src/trunk/ext/reflection/tests/bug51911.phpt (rev 0)
+++ php/php-src/trunk/ext/reflection/tests/bug51911.phpt 2010-05-25 22:46:17 UTC (rev 299763)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with constant array)
+--FILE--
+<?php
+
+class Foo {
+ const X = 1;
+ public function x($x = array(1)) {}
+}
+
+$clazz = new ReflectionClass('Foo');
+$method = $clazz->getMethod('x');
+foreach ($method->getParameters() as $param) {
+ if ( $param->isDefaultValueAvailable())
+ echo '$', $param->getName(), ' : ',
var_export($param->getDefaultValue(), 1), "\n";
+}
+
+?>
+--EXPECT--
+$x : array (
+ 0 => 1,
+)
Property changes on: php/php-src/trunk/ext/reflection/tests/bug51911.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native