summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2016-10-15 23:21:12 +0200
committerNikita Popov <nikic@php.net>2016-10-15 23:58:28 +0200
commit1903fc62988c476d26283aa1baeca86f9a0540af (patch)
tree148ff3af6602a074ebb008e2c04c53cbc1cdd707
parentb1fc1fb9376f22693b610961a097f6d0ff6dc484 (diff)
downloadphp-git-1903fc62988c476d26283aa1baeca86f9a0540af.tar.gz
Fix SplFixedArray::offsetGet() invocation for NULL offset
-rw-r--r--ext/spl/spl_fixedarray.c2
-rw-r--r--ext/spl/tests/bug64106.phpt4
2 files changed, 4 insertions, 2 deletions
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index 741b1dbf14..88b3150404 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 855caef213..26203c4e2e 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