xref: /PHP-8.1/Zend/tests/bug77877.phpt (revision f8d79582)
1--TEST--
2Bug #77877 call_user_func() passes $this to static methods
3--FILE--
4<?php
5class Foo {
6    static public function bar() {
7        var_dump($this);
8    }
9}
10try {
11    array_map([new Foo, 'bar'],[1]);
12} catch (Throwable $e) {
13    echo $e->getMessage() . "\n";
14}
15try {
16    call_user_func([new Foo, 'bar']);
17} catch (Throwable $e) {
18    echo $e->getMessage() . "\n";
19}
20?>
21--EXPECT--
22Using $this when not in object context
23Using $this when not in object context
24