logo       

cvs: ZendEngine2 / zend_compile.c: msg#00062

Subject: cvs: ZendEngine2 / zend_compile.c
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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe