From 975d26667bf7dbd0f4b739eca2e49d398105980a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 25 Mar 2013 23:48:21 +0800 Subject: [PATCH 1/4] Fixed bug #64503 (Compilation fails with error: conflicting types for 'zendparse'). --- NEWS | 2 ++ Zend/zend_language_parser.y | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 92e9c2bfe84..09ce1d13825 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 20??, PHP 5.5.0 Beta 2 - Core: + . Fixed bug #64503 (Compilation fails with error: conflicting types for + 'zendparse'). (Laruence) . Fixed bug #64239 (Debug backtrace changed behavior since 5.4.10 or 5.4.11). (Dmitry, Laruence) diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index ccbc9b174c9..6a9a24a87ea 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -41,17 +41,19 @@ static YYSIZE_T zend_yytnamerr(char*, const char*); #define YYERROR_VERBOSE #define YYSTYPE znode -#ifdef ZTS -# define YYPARSE_PARAM tsrm_ls -# define YYLEX_PARAM tsrm_ls -#endif - %} %pure_parser %expect 3 +%code requires { +#ifdef ZTS +# define YYPARSE_PARAM tsrm_ls +# define YYLEX_PARAM tsrm_ls +#endif +} + %token END 0 "end of file" %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE %token T_INCLUDE "include (T_INCLUDE)" From 5e9377ebd57f419de7b421878df540795ace01ef Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 26 Mar 2013 11:44:57 +0800 Subject: [PATCH 2/4] Fixed bug #64515 (Memoryleak when using the same variablename 2times in function declaration) --- NEWS | 2 ++ Zend/tests/bug64515.phpt | 10 ++++++++++ Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug64515.phpt diff --git a/NEWS b/NEWS index c14ea1cc873..010b8f11aba 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2013, PHP 5.4.14 - Core + . Fixed bug #64515 (Memoryleak when using the same variablename 2times in + function declaration). (Laruence) . Fixed bug #64432 (more empty delimiter warning in strX methods). (Laruence) . Fixed bug #64417 (ArrayAccess::&offsetGet() in a trait causes fatal error). (Dmitry) diff --git a/Zend/tests/bug64515.phpt b/Zend/tests/bug64515.phpt new file mode 100644 index 00000000000..d056c744312 --- /dev/null +++ b/Zend/tests/bug64515.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #64515 (Memoryleak when using the same variablename 2times in function declaration) +--FILE-- + +--EXPECT-- diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index ffa94a18625..393475259eb 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3234,7 +3234,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->result.var TSRMLS_CC); - Z_DELREF_PP(var_ptr); + zval_ptr_dtor(var_ptr); *var_ptr = assignment_value; CHECK_EXCEPTION(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 1860a0f9baa..81d36888305 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1374,7 +1374,7 @@ static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->result.var TSRMLS_CC); - Z_DELREF_PP(var_ptr); + zval_ptr_dtor(var_ptr); *var_ptr = assignment_value; CHECK_EXCEPTION(); From 1182a3356c6c1989a686aab5258e1d47c56b2955 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 26 Mar 2013 11:50:47 +0800 Subject: [PATCH 3/4] Update test script --- Zend/tests/bug64515.phpt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/tests/bug64515.phpt b/Zend/tests/bug64515.phpt index d056c744312..5390a6cdcd9 100644 --- a/Zend/tests/bug64515.phpt +++ b/Zend/tests/bug64515.phpt @@ -6,5 +6,7 @@ function foo($unused = null, $unused = null, $arg = array()) { return 1; } foo(); +echo "okey"; ?> --EXPECT-- +okey From ed315823019c8111847fb9a24293dc758ead7c3a Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Tue, 26 Mar 2013 12:02:48 +0800 Subject: [PATCH 4/4] Fixed bug #64515 (Memoryleak when using the same variablename 2times in function declaration) --- NEWS | 2 ++ Zend/tests/bug64515.phpt | 12 ++++++++++++ Zend/zend_vm_def.h | 2 +- Zend/zend_vm_execute.h | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/bug64515.phpt diff --git a/NEWS b/NEWS index 09ce1d13825..e33c7a389c8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 20??, PHP 5.5.0 Beta 2 - Core: + . Fixed bug #64515 (Memoryleak when using the same variablename 2times in + function declaration). (Laruence) . Fixed bug #64503 (Compilation fails with error: conflicting types for 'zendparse'). (Laruence) . Fixed bug #64239 (Debug backtrace changed behavior since 5.4.10 or 5.4.11). diff --git a/Zend/tests/bug64515.phpt b/Zend/tests/bug64515.phpt new file mode 100644 index 00000000000..5390a6cdcd9 --- /dev/null +++ b/Zend/tests/bug64515.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #64515 (Memoryleak when using the same variablename 2times in function declaration) +--FILE-- + +--EXPECT-- +okey diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 31a5facb526..7371d0e4404 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3262,7 +3262,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); - Z_DELREF_PP(var_ptr); + zval_ptr_dtor(var_ptr); *var_ptr = assignment_value; CHECK_EXCEPTION(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 7fe6ee1048e..8703dec2275 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1406,7 +1406,7 @@ static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); - Z_DELREF_PP(var_ptr); + zval_ptr_dtor(var_ptr); *var_ptr = assignment_value; CHECK_EXCEPTION();