summaryrefslogtreecommitdiff
path: root/Zend/tests/method_argument_binding.phpt
blob: 32acd93c63c0e4f4fc254607c5991a5f051cd8b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
Edge cases in compile-time method argument binding
--FILE--
<?php

class A {
    private function method($x) {}
}

class B extends A {
    public function test() {
        $x = 1;
        $this->method($x);
        var_dump($x);
    }
}

class C extends B {
    public function method(&$x) {
        ++$x;
    }
}

(new C)->test();

class D {
    private final function method(&$x) {
        ++$x;
    }
}

class E extends D {
    public function __call($name, $args) { }

    public function test() {
        $this->method($x);
    }
}

(new E)->test();

?>
--EXPECTF--
int(2)

Warning: Undefined variable: x in %s on line %d