diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 70dab660b3c4f..af92d674960b3 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -736,9 +736,11 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* if (type == BP_VAR_IS) { zend_call_method_with_1_params(object, ce, NULL, "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); } diff --git a/ext/spl/tests/observer_010.phpt b/ext/spl/tests/observer_010.phpt new file mode 100644 index 0000000000000..5cedff8c7cbbb --- /dev/null +++ b/ext/spl/tests/observer_010.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL: SplObjectStorage null coalescing operator memory leak +--FILE-- +