felipe Wed, 18 Aug 2010 01:59:37 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=302420
Log: - Improved fix for bug #52573 Bug: http://bugs.php.net/52573 (Closed) SplFileObject::fscanf Segmentation fault Changed paths: U php/php-src/branches/PHP_5_3/Zend/zend_compile.c U php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c U php/php-src/branches/PHP_5_3/ext/spl/tests/bug52573.phpt U php/php-src/trunk/Zend/zend_compile.c U php/php-src/trunk/ext/spl/spl_directory.c U php/php-src/trunk/ext/spl/tests/bug52573.phpt Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c =================================================================== --- php/php-src/branches/PHP_5_3/Zend/zend_compile.c 2010-08-18 01:28:15 UTC (rev 302419) +++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c 2010-08-18 01:59:37 UTC (rev 302420) @@ -2551,7 +2551,8 @@ return 0; } - if (proto->common.pass_rest_by_reference + if (fe->common.type != ZEND_USER_FUNCTION + && proto->common.pass_rest_by_reference && !fe->common.pass_rest_by_reference) { return 0; } Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-08-18 01:28:15 UTC (rev 302419) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_directory.c 2010-08-18 01:59:37 UTC (rev 302420) @@ -2583,7 +2583,7 @@ ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) ZEND_ARG_INFO(0, format) ZEND_END_ARG_INFO() Modified: php/php-src/branches/PHP_5_3/ext/spl/tests/bug52573.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug52573.phpt 2010-08-18 01:28:15 UTC (rev 302419) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug52573.phpt 2010-08-18 01:59:37 UTC (rev 302420) @@ -1,12 +1,18 @@ --TEST-- Bug #52573 (SplFileObject::fscanf Segmentation fault) --FILE-- -<?php +<?php // test $result = null; $f = new SplFileObject(__FILE__, 'r'); -$f->fscanf('<?php // %s', $result); - +var_dump($f->fscanf('<?php // %s', $result)); +var_dump($result); +var_dump($f->fscanf('<?php // %s')); ?> --EXPECTF-- -Warning: Parameter 3 to fscanf() expected to be a reference, value given in %s on line 5 +int(1) +string(4) "test" +array(1) { + [0]=> + NULL +} Modified: php/php-src/trunk/Zend/zend_compile.c =================================================================== --- php/php-src/trunk/Zend/zend_compile.c 2010-08-18 01:28:15 UTC (rev 302419) +++ php/php-src/trunk/Zend/zend_compile.c 2010-08-18 01:59:37 UTC (rev 302420) @@ -2922,7 +2922,8 @@ return 0; } - if (proto->common.pass_rest_by_reference + if (fe->common.type != ZEND_USER_FUNCTION + && proto->common.pass_rest_by_reference && !fe->common.pass_rest_by_reference) { return 0; } Modified: php/php-src/trunk/ext/spl/spl_directory.c =================================================================== --- php/php-src/trunk/ext/spl/spl_directory.c 2010-08-18 01:28:15 UTC (rev 302419) +++ php/php-src/trunk/ext/spl/spl_directory.c 2010-08-18 01:59:37 UTC (rev 302420) @@ -2586,7 +2586,7 @@ ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) ZEND_ARG_INFO(0, format) ZEND_END_ARG_INFO() Modified: php/php-src/trunk/ext/spl/tests/bug52573.phpt =================================================================== --- php/php-src/trunk/ext/spl/tests/bug52573.phpt 2010-08-18 01:28:15 UTC (rev 302419) +++ php/php-src/trunk/ext/spl/tests/bug52573.phpt 2010-08-18 01:59:37 UTC (rev 302420) @@ -1,12 +1,18 @@ --TEST-- Bug #52573 (SplFileObject::fscanf Segmentation fault) --FILE-- -<?php +<?php // test $result = null; $f = new SplFileObject(__FILE__, 'r'); -$f->fscanf('<?php // %s', $result); - +var_dump($f->fscanf('<?php // %s', $result)); +var_dump($result); +var_dump($f->fscanf('<?php // %s')); ?> --EXPECTF-- -Warning: Parameter 3 to fscanf() expected to be a reference, value given in %s on line 5 +int(1) +string(4) "test" +array(1) { + [0]=> + NULL +}
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php