Skip to content

Commit 92b603e

Browse files
committed
Observe fake closures
1 parent 23961ef commit 92b603e

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Zend/zend_observer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define ZEND_OBSERVER_NOT_OBSERVED ((void *) 2)
3030

3131
#define ZEND_OBSERVABLE_FN(fn_flags) \
32-
(!(fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE | ZEND_ACC_FAKE_CLOSURE)))
32+
(!(fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))
3333

3434
typedef struct _zend_observer_fcall_data {
3535
// points after the last handler
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
Observer: Observability of fake closures
3+
--SKIPIF--
4+
<?php if (!extension_loaded('zend_test')) die('skip: zend-test extension required'); ?>
5+
--INI--
6+
zend_test.observer.enabled=1
7+
zend_test.observer.observe_all=1
8+
--FILE--
9+
<?php
10+
class Foo
11+
{
12+
public function bar()
13+
{
14+
echo 'Called as fake closure.' . PHP_EOL;
15+
}
16+
}
17+
18+
$callable = [new Foo(), 'bar'];
19+
$closure = \Closure::fromCallable($callable);
20+
$closure();
21+
22+
echo 'DONE' . PHP_EOL;
23+
?>
24+
--EXPECTF--
25+
<!-- init '%s/observer_closure_%d.php' -->
26+
<file '%s/observer_closure_%d.php'>
27+
<!-- init Foo::bar() -->
28+
<Foo::bar>
29+
Called as fake closure.
30+
</Foo::bar>
31+
DONE
32+
</file '%s/observer_closure_%d.php'>

0 commit comments

Comments
 (0)