felipe Fri, 19 Nov 2010 20:07:32 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305565
Log: - Fixed bug #53362 (Segmentation fault when extending SplFixedArray) Bug: http://bugs.php.net/53362 (Feedback) Segmentation fault when extending SplFixedArray Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c A php/php-src/branches/PHP_5_3/ext/spl/tests/bug53362.phpt U php/php-src/trunk/ext/spl/spl_fixedarray.c A php/php-src/trunk/ext/spl/tests/bug53362.phpt Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-11-19 18:38:23 UTC (rev 305564) +++ php/php-src/branches/PHP_5_3/NEWS 2010-11-19 20:07:32 UTC (rev 305565) @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2010, PHP 5.3.4 +- Fixed bug #53362 (Segmentation fault when extending SplFixedArray). (Felipe) - Fixed bug #47168 (printf of floating point variable prints maximum of 40 decimal places). (Ilia) Modified: php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c 2010-11-19 18:38:23 UTC (rev 305564) +++ php/php-src/branches/PHP_5_3/ext/spl/spl_fixedarray.c 2010-11-19 20:07:32 UTC (rev 305565) @@ -409,7 +409,11 @@ intern = (spl_fixedarray_object *)zend_object_store_get_object(object TSRMLS_CC); if (intern->fptr_offset_set) { - SEPARATE_ARG_IF_REF(offset); + if (!offset) { + ALLOC_INIT_ZVAL(offset); + } else { + SEPARATE_ARG_IF_REF(offset); + } SEPARATE_ARG_IF_REF(value); zend_call_method_with_2_params(&object, intern->std.ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value); zval_ptr_dtor(&value); Added: php/php-src/branches/PHP_5_3/ext/spl/tests/bug53362.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/spl/tests/bug53362.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/spl/tests/bug53362.phpt 2010-11-19 20:07:32 UTC (rev 305565) @@ -0,0 +1,22 @@ +--TEST-- +Bug #53362 (Segmentation fault when extending SplFixedArray) +--FILE-- +<?php + +class obj extends SplFixedArray{ + public function offsetSet($offset, $value) { + var_dump($offset); + } +} + +$obj = new obj; + +$obj[]=2; +$obj[]=2; +$obj[]=2; + +?> +--EXPECTF-- +NULL +NULL +NULL Property changes on: php/php-src/branches/PHP_5_3/ext/spl/tests/bug53362.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Modified: php/php-src/trunk/ext/spl/spl_fixedarray.c =================================================================== --- php/php-src/trunk/ext/spl/spl_fixedarray.c 2010-11-19 18:38:23 UTC (rev 305564) +++ php/php-src/trunk/ext/spl/spl_fixedarray.c 2010-11-19 20:07:32 UTC (rev 305565) @@ -409,7 +409,11 @@ intern = (spl_fixedarray_object *)zend_object_store_get_object(object TSRMLS_CC); if (intern->fptr_offset_set) { - SEPARATE_ARG_IF_REF(offset); + if (!offset) { + ALLOC_INIT_ZVAL(offset); + } else { + SEPARATE_ARG_IF_REF(offset); + } SEPARATE_ARG_IF_REF(value); zend_call_method_with_2_params(&object, intern->std.ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value); zval_ptr_dtor(&value); Added: php/php-src/trunk/ext/spl/tests/bug53362.phpt =================================================================== --- php/php-src/trunk/ext/spl/tests/bug53362.phpt (rev 0) +++ php/php-src/trunk/ext/spl/tests/bug53362.phpt 2010-11-19 20:07:32 UTC (rev 305565) @@ -0,0 +1,22 @@ +--TEST-- +Bug #53362 (Segmentation fault when extending SplFixedArray) +--FILE-- +<?php + +class obj extends SplFixedArray{ + public function offsetSet($offset, $value) { + var_dump($offset); + } +} + +$obj = new obj; + +$obj[]=2; +$obj[]=2; +$obj[]=2; + +?> +--EXPECTF-- +NULL +NULL +NULL Property changes on: php/php-src/trunk/ext/spl/tests/bug53362.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