intern = Z_SPLFIXEDARRAY_P(object);
+ if (type == BP_VAR_IS && intern->fptr_offset_has) {
+ SEPARATE_ARG_IF_REF(offset);
+ zend_call_method_with_1_params(object, intern->std.ce, &intern->fptr_offset_has, "offsetexists", rv, offset);
+ if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
+ zval_ptr_dtor(offset);
+ return NULL;
+ }
+ if (!i_zend_is_true(rv)) {
+ zval_ptr_dtor(offset);
+ zval_ptr_dtor(rv);
+ return &EG(uninitialized_zval);
+ }
+ zval_ptr_dtor(rv);
+ }
+
if (intern->fptr_offset_get) {
zval tmp;
if (!offset) {
--- /dev/null
+--TEST--\r
+Bug #74478: null coalescing operator failing with SplFixedArray\r
+--FILE--\r
+<?php\r
+\r
+class MyFixedArray extends \SplFixedArray\r
+{\r
+ public function offsetExists($name) {\r
+ echo "offsetExists($name)\n";\r
+ return parent::offsetExists($name);\r
+ }\r
+ public function offsetGet($name) {\r
+ echo "offsetGet($name)\n";\r
+ return parent::offsetGet($name);\r
+ }\r
+ public function offsetSet($name, $value) {\r
+ echo "offsetSet($name)\n";\r
+ return parent::offsetSet($name, $value);\r
+ }\r
+ public function offsetUnset($name) {\r
+ echo "offsetUnset($name)\n";\r
+ return parent::offsetUnset($name);\r
+ }\r
+\r
+};\r
+\r
+$fixedData = new MyFixedArray(10);\r
+var_dump(isset($fixedData[0][1][2]));\r
+var_dump(isset($fixedData[0]->foo));\r
+var_dump($fixedData[0] ?? 42);\r
+var_dump($fixedData[0][1][2] ?? 42);\r
+\r
+$fixedData[0] = new MyFixedArray(10);\r
+$fixedData[0][1] = new MyFixedArray(10);\r
+var_dump(isset($fixedData[0][1][2]));\r
+var_dump($fixedData[0][1][2] ?? 42);\r
+\r
+?>\r
+--EXPECT--\r
+offsetExists(0)\r
+bool(false)\r
+offsetExists(0)\r
+bool(false)\r
+offsetExists(0)\r
+int(42)\r
+offsetExists(0)\r
+int(42)\r
+offsetSet(0)\r
+offsetGet(0)\r
+offsetSet(1)\r
+offsetExists(0)\r
+offsetGet(0)\r
+offsetExists(1)\r
+offsetGet(1)\r
+offsetExists(2)\r
+bool(false)\r
+offsetExists(0)\r
+offsetGet(0)\r
+offsetExists(1)\r
+offsetGet(1)\r
+offsetExists(2)\r
+int(42)
\ No newline at end of file