diff options
Diffstat (limited to 'Zend/tests/method_argument_binding.phpt')
-rw-r--r-- | Zend/tests/method_argument_binding.phpt | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Zend/tests/method_argument_binding.phpt b/Zend/tests/method_argument_binding.phpt new file mode 100644 index 0000000000..731cc4fb32 --- /dev/null +++ b/Zend/tests/method_argument_binding.phpt @@ -0,0 +1,47 @@ +--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-- +Warning: Declaration of C::method(&$x) should be compatible with A::method($x) in %s on line %d +int(2) + +Notice: Undefined variable: x in %s on line %d |