mirror of
https://github.com/php/php-src.git
synced 2024-09-29 05:46:06 +00:00
cdb7aafc23
The SEPARATE_ARG_IF_REF macro increased the refcount of the object passed as a key. However, when the key did not exist in the ArrayAccess implementation, the code returned early without trying to decrement the refcount. Add a test of `??` succeeding+failing on a SplObjectStorage instance.
16 lines
351 B
PHP
16 lines
351 B
PHP
--TEST--
|
|
SPL: SplObjectStorage null coalescing operator memory leak
|
|
--FILE--
|
|
<?php
|
|
// In maintainer zts mode, this should no longer
|
|
// detect memory leaks for the objects
|
|
$a = new stdClass();
|
|
$b = new stdClass();
|
|
$map = new SplObjectStorage();
|
|
$map[$a] = 'foo';
|
|
var_dump($map[$b] ?? null);
|
|
var_dump($map[$a] ?? null);
|
|
--EXPECTF--
|
|
NULL
|
|
string(3) "foo"
|