From ab97606b8a9501599cf027b13b72fc0c92e3a16e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 5 May 2015 19:52:03 +0200 Subject: Fix compiler assumptions about self/etc wrt closures * Don't throw an error if self/parent/static are used in a closure (outside a class). * Don't propagate self:: constants into closures * Use runtime fetch for self::class in closures Fixes bug #66811. --- .../no_class_const_propagation_in_closures.phpt | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Zend/tests/no_class_const_propagation_in_closures.phpt (limited to 'Zend/tests/no_class_const_propagation_in_closures.phpt') diff --git a/Zend/tests/no_class_const_propagation_in_closures.phpt b/Zend/tests/no_class_const_propagation_in_closures.phpt new file mode 100644 index 0000000000..e446573b9d --- /dev/null +++ b/Zend/tests/no_class_const_propagation_in_closures.phpt @@ -0,0 +1,25 @@ +--TEST-- +self:: class constants should not be propagated into closures, due to scope rebinding +--FILE-- +f(); +var_dump($f->bindTo(null, 'B')()); + +?> +--EXPECT-- +string(4) "B::C" -- cgit v1.2.1