diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-04-27 13:30:53 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-04-27 13:30:53 +0000 |
commit | abb07db4c6359d15a0ab9d8c8735c5a93ac429a6 (patch) | |
tree | 950ff1df6a4eab7d1507c6a43214d0c064216499 | |
parent | 5d4230a7e7ee37f3aa08fecdec686e4329e19d5e (diff) | |
download | php-git-abb07db4c6359d15a0ab9d8c8735c5a93ac429a6.tar.gz |
Fixed bug #29104 (Function declaration in method doesn't work)
-rw-r--r-- | Zend/tests/bug29104.phpt | 27 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 |
2 files changed, 28 insertions, 1 deletions
diff --git a/Zend/tests/bug29104.phpt b/Zend/tests/bug29104.phpt new file mode 100644 index 0000000000..c7afbee073 --- /dev/null +++ b/Zend/tests/bug29104.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #29104 Function declaration in method doesn't work +--FILE-- +<?php +class A +{ + function g() + { + echo "function g - begin\n"; + + function f() + { + echo "function f\n"; + } + + echo "function g - end\n"; + } +} + +$a = new A; +$a->g(); +f(); +?> +--EXPECT-- +function g - begin +function g - end +function f diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d3ee2c3f02..de876333d0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1039,7 +1039,7 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n op_array.fn_flags = fn_flags; op_array.pass_rest_by_reference = 0; - op_array.scope = CG(active_class_entry); + op_array.scope = is_method?CG(active_class_entry):NULL; op_array.prototype = NULL; op_array.line_start = zend_get_compiled_lineno(TSRMLS_C); |