mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Added test and possible fix for https://bugs.php.net/bug.php?id=67068
This commit is contained in:
parent
af1f867308
commit
dbc0a80b23
2 changed files with 19 additions and 0 deletions
|
@ -449,6 +449,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
|
|||
|
||||
closure->func = *func;
|
||||
closure->func.common.prototype = NULL;
|
||||
closure->func.common.fn_flags |= ZEND_ACC_CLOSURE;
|
||||
|
||||
if ((scope == NULL) && (this_ptr != NULL)) {
|
||||
/* use dummy scope if we're binding an object without specifying a scope */
|
||||
|
|
18
ext/reflection/tests/bug67068.phpt
Normal file
18
ext/reflection/tests/bug67068.phpt
Normal file
|
@ -0,0 +1,18 @@
|
|||
--TEST--
|
||||
Bug #67068 (ReflectionFunction::getClosure returns something that doesn't report as a closure)
|
||||
--FILE--
|
||||
<?php
|
||||
class MyClass {
|
||||
public function method() {}
|
||||
}
|
||||
|
||||
$object = new MyClass;
|
||||
$reflector = new \ReflectionMethod($object, 'method');
|
||||
$closure = $reflector->getClosure($object);
|
||||
|
||||
$closureReflector = new \ReflectionFunction($closure);
|
||||
|
||||
var_dump($closureReflector->isClosure());
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
Loading…
Add table
Add a link
Reference in a new issue