mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Update NEWS Fix memory leak(null coalescing operator with Spl hash)
This commit is contained in:
commit
270f9a0216
2 changed files with 17 additions and 0 deletions
|
@ -792,9 +792,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);
|
||||
}
|
||||
|
|
15
ext/spl/tests/observer_010.phpt
Normal file
15
ext/spl/tests/observer_010.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--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"
|
Loading…
Add table
Add a link
Reference in a new issue