1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.2'

* PHP-8.2:
  Fix reference returned from CallbackFilterIterator::accept()
This commit is contained in:
Ilija Tovilo
2023-04-20 13:43:29 +02:00
2 changed files with 16 additions and 0 deletions

View 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

View File

@@ -1822,6 +1822,8 @@ PHP_METHOD(CallbackFilterIterator, accept)
zend_call_known_fcc(fcc, return_value, 3, params, NULL);
if (Z_ISUNDEF_P(return_value)) {
RETURN_FALSE;
} else if (Z_ISREF_P(return_value)) {
zend_unwrap_reference(return_value);
}
}
/* }}} */