From eb51b4f23a9251d700ae19e51876b90ec4306fdf Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 27 Apr 2005 14:30:33 +0000 Subject: [PATCH] Fixed bug #29104 (Function declaration in method doesn't work) --- NEWS | 1 + Zend/tests/bug29104.phpt | 27 +++++++++++++++++++++++++++ Zend/zend_compile.c | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 Zend/tests/bug29104.phpt diff --git a/NEWS b/NEWS index 1b15745bbb..f50e5a28e6 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,7 @@ PHP NEWS (Dmitry) - Fixed bug #29944 (Function defined in switch, crashes). (Dmitry) - Fixed bug #29583 (crash when echoing a COM object). (M.Sisolak, Wez) +- Fixed bug #29104 (Function declaration in method doesn't work). (Dmitry) - Fixed bug #28839 (SIGSEGV in interactive mode (php -a)). (kameshj at fastmail dot fm) 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-- +g(); +f(); +?> +--EXPECT-- +function g - begin +function g - end +function f diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 72bcba6d8a..a9bcaf5f55 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -965,7 +965,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); -- 2.50.1