felipe Mon, 03 Aug 2009 13:16:24 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286733
Log: - Re-fix stream_is_local() memory leaks Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/standard/streamsfuncs.c A php/php-src/branches/PHP_5_2/ext/standard/tests/streams/stream_is_local.phpt U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/standard/streamsfuncs.c A php/php-src/branches/PHP_5_3/ext/standard/tests/streams/stream_is_local.phpt U php/php-src/trunk/ext/standard/streamsfuncs.c A php/php-src/trunk/ext/standard/tests/streams/stream_is_local.phpt Modified: php/php-src/branches/PHP_5_2/NEWS =================================================================== --- php/php-src/branches/PHP_5_2/NEWS 2009-08-03 13:02:53 UTC (rev 286732) +++ php/php-src/branches/PHP_5_2/NEWS 2009-08-03 13:16:24 UTC (rev 286733) @@ -3,6 +3,7 @@ ?? ??? 2009, PHP 5.2.11 - Fixed regression in cURL extension that prevented flush of data to output defined as a file handle. (Ilia) +- Fixed memory leak in stream_is_local(). (Felipe) - Fixed bug #49132 (posix_times returns false without error). (phpbugs at gunnu dot us) Modified: php/php-src/branches/PHP_5_2/ext/standard/streamsfuncs.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/streamsfuncs.c 2009-08-03 13:02:53 UTC (rev 286732) +++ php/php-src/branches/PHP_5_2/ext/standard/streamsfuncs.c 2009-08-03 13:16:24 UTC (rev 286733) @@ -1397,8 +1397,17 @@ } wrapper = stream->wrapper; } else { - convert_to_string_ex(&zstream); - wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0 TSRMLS_CC); + zval *copy_tmp; + + ALLOC_ZVAL(copy_tmp); + *copy_tmp = *zstream; + zval_copy_ctor(copy_tmp); + INIT_PZVAL(copy_tmp); + convert_to_string(copy_tmp); + + wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(copy_tmp), NULL, 0 TSRMLS_CC); + + zval_ptr_dtor(©_tmp); } if(!wrapper) { Added: php/php-src/branches/PHP_5_2/ext/standard/tests/streams/stream_is_local.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/tests/streams/stream_is_local.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/standard/tests/streams/stream_is_local.phpt 2009-08-03 13:16:24 UTC (rev 286733) @@ -0,0 +1,17 @@ +--TEST-- +Testing stream_is_local() +--FILE-- +<?php + +$a = 1; +$b = $a; +var_dump(stream_is_local($b)); +var_dump($b); + +var_dump(stream_is_local(fopen(__FILE__, 'r'))); + +?> +--EXPECT-- +bool(true) +int(1) +bool(true) Property changes on: php/php-src/branches/PHP_5_2/ext/standard/tests/streams/stream_is_local.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 2009-08-03 13:02:53 UTC (rev 286732) +++ php/php-src/branches/PHP_5_3/NEWS 2009-08-03 13:16:24 UTC (rev 286733) @@ -6,6 +6,7 @@ - Fixed open_basedir circumvention for mail.log. (Maksymilian Arciemowicz, Stas) - Fixed signature generation/validation for zip archives in ext/phar. (Greg) +- Fixed memory leak in stream_is_local(). (Felipe) - Fixed bug #49132 (posix_times returns false without error). (phpbugs at gunnu dot us) Modified: php/php-src/branches/PHP_5_3/ext/standard/streamsfuncs.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/streamsfuncs.c 2009-08-03 13:02:53 UTC (rev 286732) +++ php/php-src/branches/PHP_5_3/ext/standard/streamsfuncs.c 2009-08-03 13:16:24 UTC (rev 286733) @@ -1463,8 +1463,17 @@ } wrapper = stream->wrapper; } else { - convert_to_string_ex(&zstream); - wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0 TSRMLS_CC); + zval *copy_tmp; + + ALLOC_ZVAL(copy_tmp); + *copy_tmp = *zstream; + zval_copy_ctor(copy_tmp); + INIT_PZVAL(copy_tmp); + convert_to_string(copy_tmp); + + wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(copy_tmp), NULL, 0 TSRMLS_CC); + + zval_ptr_dtor(©_tmp); } if(!wrapper) { Added: php/php-src/branches/PHP_5_3/ext/standard/tests/streams/stream_is_local.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/streams/stream_is_local.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/streams/stream_is_local.phpt 2009-08-03 13:16:24 UTC (rev 286733) @@ -0,0 +1,17 @@ +--TEST-- +Testing stream_is_local() +--FILE-- +<?php + +$a = 1; +$b = $a; +var_dump(stream_is_local($b)); +var_dump($b); + +var_dump(stream_is_local(fopen(__FILE__, 'r'))); + +?> +--EXPECT-- +bool(true) +int(1) +bool(true) Property changes on: php/php-src/branches/PHP_5_3/ext/standard/tests/streams/stream_is_local.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Modified: php/php-src/trunk/ext/standard/streamsfuncs.c =================================================================== --- php/php-src/trunk/ext/standard/streamsfuncs.c 2009-08-03 13:02:53 UTC (rev 286732) +++ php/php-src/trunk/ext/standard/streamsfuncs.c 2009-08-03 13:16:24 UTC (rev 286733) @@ -1750,8 +1750,17 @@ } wrapper = stream->wrapper; } else { - convert_to_string_ex(&zstream); - wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0 TSRMLS_CC); + zval *copy_tmp; + + ALLOC_ZVAL(copy_tmp); + *copy_tmp = *zstream; + zval_copy_ctor(copy_tmp); + INIT_PZVAL(copy_tmp); + convert_to_string(copy_tmp); + + wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(copy_tmp), NULL, 0 TSRMLS_CC); + + zval_ptr_dtor(©_tmp); } if(!wrapper) { Added: php/php-src/trunk/ext/standard/tests/streams/stream_is_local.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/streams/stream_is_local.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/streams/stream_is_local.phpt 2009-08-03 13:16:24 UTC (rev 286733) @@ -0,0 +1,17 @@ +--TEST-- +Testing stream_is_local() +--FILE-- +<?php + +$a = 1; +$b = $a; +var_dump(stream_is_local($b)); +var_dump($b); + +var_dump(stream_is_local(fopen(__FILE__, 'r'))); + +?> +--EXPECT-- +bool(true) +int(1) +bool(true) Property changes on: php/php-src/trunk/ext/standard/tests/streams/stream_is_local.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php