dmitry Wed Feb 22 09:03:26 2006 UTC
Modified files:
/ZendEngine2 zend_compile.c
Log:
Unicode support: fixed check for direct call to __clone()
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_compile.c?r1=1.684&r2=1.685&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.684 ZendEngine2/zend_compile.c:1.685
--- ZendEngine2/zend_compile.c:1.684 Tue Feb 21 20:12:41 2006
+++ ZendEngine2/zend_compile.c Wed Feb 22 09:03:26 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.684 2006/02/21 20:12:41 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.685 2006/02/22 09:03:26 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -1434,9 +1434,19 @@
last_op_number = get_next_op_number(CG(active_op_array))-1;
last_op = &CG(active_op_array)->opcodes[last_op_number];
- if ((last_op->op2.op_type == IS_CONST) &&
(Z_TYPE(last_op->op2.u.constant) == IS_STRING) &&
(Z_STRLEN(last_op->op2.u.constant) == sizeof(ZEND_CLONE_FUNC_NAME)-1)
- && !zend_binary_strcasecmp(Z_STRVAL(last_op->op2.u.constant),
Z_STRLEN(last_op->op2.u.constant), ZEND_CLONE_FUNC_NAME,
sizeof(ZEND_CLONE_FUNC_NAME)-1)) {
- zend_error(E_COMPILE_ERROR, "Cannot call __clone() method on
objects - use 'clone $obj' instead");
+ if (last_op->op2.op_type == IS_CONST &&
+ (Z_TYPE(last_op->op2.u.constant) == IS_STRING ||
+ Z_TYPE(last_op->op2.u.constant) == IS_UNICODE) &&
+ Z_UNILEN(last_op->op2.u.constant) ==
sizeof(ZEND_CLONE_FUNC_NAME)-1) {
+ zstr lcname;
+ unsigned int lcname_len;
+
+ lcname = zend_u_str_case_fold(Z_TYPE(last_op->op2.u.constant),
Z_UNIVAL(last_op->op2.u.constant), Z_UNILEN(last_op->op2.u.constant), 0,
&lcname_len);
+ if (ZEND_U_EQUAL(Z_TYPE(last_op->op2.u.constant), lcname,
lcname_len, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1)) {
+ efree(lcname.v);
+ zend_error(E_COMPILE_ERROR, "Cannot call __clone()
method on objects - use 'clone $obj' instead");
+ }
+ efree(lcname.v);
}
if (last_op->opcode == ZEND_FETCH_OBJ_R) {
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|