Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Zend/tests/closures/oss_fuzz_538730793.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
OSS-Fuzz #538730793 (Assertion failure when returning by-ref from closure invoke)
--FILE--
<?php

$x = function&(){};
$y = $x->__invoke();
var_dump($y);

?>
--EXPECTF--
Notice: Only variable references should be returned by reference in %s on line %d
NULL
1 change: 1 addition & 0 deletions Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */
zend_closure_get_closure(Z_OBJ_P(ZEND_THIS), &fcc.calling_scope, &fcc.function_handler, &fcc.object, false);
fcc.called_scope = fcc.calling_scope;
zend_call_known_fcc(&fcc, return_value, num_args, args, named_args);
zend_return_unwrap_ref(execute_data, return_value);

/* destruct the function also, then - we have allocated it in get_method */
zend_string_release_ex(func->internal_function.function_name, 0);
Expand Down
Loading