cvs: ZendEngine2(PHP_5_2) / zend_compile.c zend_execute_API.c zend_object_handlers.c zend_vm_def.h zend_vm_execute.h /tests bug47801.phpt php-src NEWS
[email protected] ("Felipe Pena") Wed, 08 Apr 2009 00:28:08 -0000
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsfelipe1239150488@cvsserver> |
felipe Wed Apr 8 00:28:08 2009 UTC
Added files: (Branch: PHP_5_2)
/ZendEngine2/tests bug47801.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_compile.c zend_execute_API.c
zend_object_handlers.c zend_vm_def.h zend_vm_execute.h
Log:
- Fixed bug #47801 (__call() accessed via parent:: operator is provided incorrect method name)
felipe-20090408002808.txt
(text/plain, 12.1 KB)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1465&r2=1.2027.2.547.2.1466&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1465 php-src/NEWS:1.2027.2.547.2.1466
--- php-src/NEWS:1.2027.2.547.2.1465 Tue Apr 7 17:06:53 2009
+++ php-src/NEWS Wed Apr 8 00:28:03 2009
@@ -19,6 +19,8 @@
- Fixed bug #47828 (openssl_x509_parse() segfaults when a UTF-8 conversion
fails). (Scott, Kees Cook, Pierre)
- Fixed bug #47818 (Segfault due to bound callback param). (Felipe)
+- Fixed bug #47801 (__call() accessed via parent:: operator is provided
+ incorrect method name). (Felipe)
- Fixed bug #47769 (Strange extends PDO). (Felipe)
- Fixed bug #47745 (FILTER_VALIDATE_INT doesn't allow minimum integer).
(Dmitry)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.54&r2=1.647.2.27.2.55&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.54 ZendEngine2/zend_compile.c:1.647.2.27.2.55
--- ZendEngine2/zend_compile.c:1.647.2.27.2.54 Mon Jan 26 21:27:41 2009
+++ ZendEngine2/zend_compile.c Wed Apr 8 00:28:04 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.647.2.27.2.54 2009/01/26 21:27:41 dsp Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.55 2009/04/08 00:28:04 felipe Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -1536,11 +1536,8 @@
memcmp(lcname, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1) == 0) {
zval_dtor(&opline->op2.u.constant);
SET_UNUSED(opline->op2);
- efree(lcname);
- } else {
- efree(opline->op2.u.constant.value.str.val);
- opline->op2.u.constant.value.str.val = lcname;
}
+ efree(lcname);
}
zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.30&r2=1.331.2.20.2.31&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.30 ZendEngine2/zend_execute_API.c:1.331.2.20.2.31
--- ZendEngine2/zend_execute_API.c:1.331.2.20.2.30 Thu Jan 15 14:23:42 2009
+++ ZendEngine2/zend_execute_API.c Wed Apr 8 00:28:04 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.30 2009/01/15 14:23:42 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.31 2009/04/08 00:28:04 felipe Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -835,11 +835,8 @@
efree(function_name_lc);
}
} else if (calling_scope) {
- char *function_name_lc = zend_str_tolower_dup(fname, fname_len);
+ EX(function_state).function = zend_std_get_static_method(calling_scope, fname, fname_len TSRMLS_CC);
- EX(function_state).function =
- zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
- efree(function_name_lc);
if (check_scope_or_static && EX(function_state).function
&& !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)
&& !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.32&r2=1.135.2.6.2.33&diff_format=u
Index: ZendEngine2/zend_object_handlers.c
diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.32 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.33
--- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.32 Tue Feb 17 17:09:05 2009
+++ ZendEngine2/zend_object_handlers.c Wed Apr 8 00:28:04 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_object_handlers.c,v 1.135.2.6.2.32 2009/02/17 17:09:05 iliaa Exp $ */
+/* $Id: zend_object_handlers.c,v 1.135.2.6.2.33 2009/04/08 00:28:04 felipe Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -856,9 +856,14 @@
/* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */
ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC)
{
- zend_function *fbc;
+ char *lc_function_name;
+ zend_function *fbc;
+
+ lc_function_name = zend_str_tolower_dup(function_name_strval, function_name_strlen);
+
+ if (zend_hash_find(&ce->function_table, lc_function_name, function_name_strlen+1, (void **) &fbc)==FAILURE) {
+ efree(lc_function_name);
- if (zend_hash_find(&ce->function_table, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) {
if (ce->__call &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
@@ -886,6 +891,8 @@
zend_error(E_ERROR, "Call to undefined method %s::%s()", class_name, function_name_strval);
}
}
+ efree(lc_function_name);
+
if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) {
/* No further checks necessary, most common case */
} else if (fbc->op_array.fn_flags & ZEND_ACC_PRIVATE) {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.66&r2=1.59.2.29.2.67&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.66 ZendEngine2/zend_vm_def.h:1.59.2.29.2.67
--- ZendEngine2/zend_vm_def.h:1.59.2.29.2.66 Wed Mar 18 13:11:30 2009
+++ ZendEngine2/zend_vm_def.h Wed Apr 8 00:28:04 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.59.2.29.2.66 2009/03/18 13:11:30 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.59.2.29.2.67 2009/04/08 00:28:04 felipe Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -1795,7 +1795,7 @@
ce = EX_T(opline->op1.u.var).class_entry;
if(OP2_TYPE != IS_UNUSED) {
- char *function_name_strval;
+ char *function_name_strval = NULL;
int function_name_strlen;
zend_bool is_const = (OP2_TYPE == IS_CONST);
zend_free_op free_op2;
@@ -1808,15 +1808,17 @@
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
+ } else {
+ function_name_strval = Z_STRVAL_P(function_name);
+ function_name_strlen = Z_STRLEN_P(function_name);
}
- function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
- function_name_strlen = function_name->value.str.len;
}
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (function_name_strval) {
+ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ }
if (!is_const) {
- efree(function_name_strval);
FREE_OP2();
}
} else {
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.69&r2=1.62.2.30.2.70&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.69 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.70
--- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.69 Wed Mar 18 13:11:30 2009
+++ ZendEngine2/zend_vm_execute.h Wed Apr 8 00:28:04 2009
@@ -667,7 +667,7 @@
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_CONST != IS_UNUSED) {
- char *function_name_strval;
+ char *function_name_strval = NULL;
int function_name_strlen;
zend_bool is_const = (IS_CONST == IS_CONST);
@@ -680,15 +680,17 @@
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
+ } else {
+ function_name_strval = Z_STRVAL_P(function_name);
+ function_name_strlen = Z_STRLEN_P(function_name);
}
- function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
- function_name_strlen = function_name->value.str.len;
}
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (function_name_strval) {
+ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ }
if (!is_const) {
- efree(function_name_strval);
}
} else {
@@ -878,7 +880,7 @@
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_TMP_VAR != IS_UNUSED) {
- char *function_name_strval;
+ char *function_name_strval = NULL;
int function_name_strlen;
zend_bool is_const = (IS_TMP_VAR == IS_CONST);
zend_free_op free_op2;
@@ -891,15 +893,17 @@
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
+ } else {
+ function_name_strval = Z_STRVAL_P(function_name);
+ function_name_strlen = Z_STRLEN_P(function_name);
}
- function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
- function_name_strlen = function_name->value.str.len;
}
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (function_name_strval) {
+ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ }
if (!is_const) {
- efree(function_name_strval);
zval_dtor(free_op2.var);
}
} else {
@@ -1049,7 +1053,7 @@
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_VAR != IS_UNUSED) {
- char *function_name_strval;
+ char *function_name_strval = NULL;
int function_name_strlen;
zend_bool is_const = (IS_VAR == IS_CONST);
zend_free_op free_op2;
@@ -1062,15 +1066,17 @@
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
+ } else {
+ function_name_strval = Z_STRVAL_P(function_name);
+ function_name_strlen = Z_STRLEN_P(function_name);
}
- function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
- function_name_strlen = function_name->value.str.len;
}
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (function_name_strval) {
+ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ }
if (!is_const) {
- efree(function_name_strval);
if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
}
} else {
@@ -1219,7 +1225,7 @@
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_UNUSED != IS_UNUSED) {
- char *function_name_strval;
+ char *function_name_strval = NULL;
int function_name_strlen;
zend_bool is_const = (IS_UNUSED == IS_CONST);
@@ -1232,15 +1238,17 @@
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
+ } else {
+ function_name_strval = Z_STRVAL_P(function_name);
+ function_name_strlen = Z_STRLEN_P(function_name);
}
- function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
- function_name_strlen = function_name->value.str.len;
}
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (function_name_strval) {
+ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ }
if (!is_const) {
- efree(function_name_strval);
}
} else {
@@ -1322,7 +1330,7 @@
ce = EX_T(opline->op1.u.var).class_entry;
if(IS_CV != IS_UNUSED) {
- char *function_name_strval;
+ char *function_name_strval = NULL;
int function_name_strlen;
zend_bool is_const = (IS_CV == IS_CONST);
@@ -1335,15 +1343,17 @@
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
+ } else {
+ function_name_strval = Z_STRVAL_P(function_name);
+ function_name_strlen = Z_STRLEN_P(function_name);
}
- function_name_strval = zend_str_tolower_dup(function_name->value.str.val, function_name->value.str.len);
- function_name_strlen = function_name->value.str.len;
}
- EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ if (function_name_strval) {
+ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
+ }
if (!is_const) {
- efree(function_name_strval);
}
} else {
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug47801.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug47801.phpt
+++ ZendEngine2/tests/bug47801.phpt