]> granicus.if.org Git - php/commitdiff
Test use($this) being an error
authorNikita Popov <nikic@php.net>
Tue, 23 Sep 2014 19:36:45 +0000 (21:36 +0200)
committerNikita Popov <nikic@php.net>
Wed, 24 Sep 2014 10:06:19 +0000 (12:06 +0200)
Zend/tests/this_as_lexical_var_error.phpt [new file with mode: 0644]

diff --git a/Zend/tests/this_as_lexical_var_error.phpt b/Zend/tests/this_as_lexical_var_error.phpt
new file mode 100644 (file)
index 0000000..d0e0106
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Cannot use $this as lexical variable
+--FILE--
+<?php
+
+class Foo {
+    public function fn() {
+        return function() use ($this) {};
+    }
+}
+
+?>
+--EXPECTF--
+Fatal error: Cannot use $this as lexical variable in %s on line %d