mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.2'
* PHP-8.2: Fix reference returned from CallbackFilterIterator::accept()
This commit is contained in:
commit
04fd04acab
2 changed files with 16 additions and 0 deletions
14
Zend/tests/oss_fuzz_58181.phpt
Normal file
14
Zend/tests/oss_fuzz_58181.phpt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
--TEST--
|
||||||
|
oss-fuzz #58181: Fix unexpected reference returned from CallbackFilterIterator::accept()
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
function test(array $data) {
|
||||||
|
$iterator = new ArrayIterator($data);
|
||||||
|
$iterator = new \CallbackFilterIterator($iterator, fn&() => true);
|
||||||
|
$iterator->rewind();
|
||||||
|
}
|
||||||
|
|
||||||
|
test(['a', 'b']);
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Notice: Only variable references should be returned by reference in %s on line %d
|
|
@ -1822,6 +1822,8 @@ PHP_METHOD(CallbackFilterIterator, accept)
|
||||||
zend_call_known_fcc(fcc, return_value, 3, params, NULL);
|
zend_call_known_fcc(fcc, return_value, 3, params, NULL);
|
||||||
if (Z_ISUNDEF_P(return_value)) {
|
if (Z_ISUNDEF_P(return_value)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
} else if (Z_ISREF_P(return_value)) {
|
||||||
|
zend_unwrap_reference(return_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue