com php-src: Fix SplFixedArray::offsetGet() invocation for NULL offset: ext/spl/spl_fixedarray.c ext/spl/tests/bug64106 .phpt

From: Date: Sat, 15 Oct 2016 21:58:28 +0000
Subject: com php-src: Fix SplFixedArray::offsetGet() invocation for NULL offset: ext/spl/spl_fixedarray.c ext/spl/tests/bug64106 .phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95106@lists.php.net to get a copy of this message
Commit: 1903fc62988c476d26283aa1baeca86f9a0540af Author: Nikita Popov <nikic@php.net> Sat, 15 Oct 2016 23:21:12 +0200 Parents: b1fc1fb9376f22693b610961a097f6d0ff6dc484 Branches: PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1903fc62988c476d26283aa1baeca86f9a0540af Log: Fix SplFixedArray::offsetGet() invocation for NULL offset Changed paths: M ext/spl/spl_fixedarray.c M ext/spl/tests/bug64106.phpt Diff: diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 741b1db..88b3150 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -349,7 +349,7 @@ static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, in if (intern->fptr_offset_get) { zval tmp; if (!offset) { - ZVAL_UNDEF(&tmp); + ZVAL_NULL(&tmp); offset = &tmp; } else { SEPARATE_ARG_IF_REF(offset); diff --git a/ext/spl/tests/bug64106.phpt b/ext/spl/tests/bug64106.phpt index 855caef..26203c4 100644 --- a/ext/spl/tests/bug64106.phpt +++ b/ext/spl/tests/bug64106.phpt @@ -4,7 +4,7 @@ Bug #64106: Segfault on SplFixedArray[][x] = y when extended <?php class MyFixedArray extends SplFixedArray { - public function offsetGet($offset) {} + public function offsetGet($offset) { var_dump($offset); } } $array = new MyFixedArray(10); @@ -12,4 +12,6 @@ $array[][1] = 10; ?> --EXPECTF-- +NULL + Notice: Indirect modification of overloaded element of MyFixedArray has no effect in %s on line %d

« previous php.cvs (#95106) next »