Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c

From: Date: Mon, 25 Jul 2005 20:48:50 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3937@lists.php.net to get a copy of this message
Hi Marcus, I'd like to understand this better. It seems the bug # you wrote here is wrong. Can you please double check? Thanks, Andi At 08:24 PM 7/25/2005 +0000, Marcus Boerger wrote:
helly           Mon Jul 25 16:24:13 2005 EDT
Modified files:
    /ZendEngine2        zend_API.c
Log: - Fix #33853 # When a static class function is being called then we first look for the # class with name unchanged. If the class is then not available it the # method can never be callable, thus we return 0. If the class is available # the lowercased name will be broken up into class and function and 1 is # being returned. http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.292&r2=1.293&ty=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.292 ZendEngine2/zend_API.c:1.293
--- ZendEngine2/zend_API.c:1.292        Mon Jul 18 12:19:50 2005
+++ ZendEngine2/zend_API.c      Mon Jul 25 16:24:11 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: zend_API.c,v 1.292 2005/07/18 16:19:50 dmitry Exp $ */ +/* $Id: zend_API.c,v 1.293 2005/07/25 20:24:11 helly Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2034,8 +2034,10 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC) {
-       char *lcname, *func;
+       char *lcname, *func, *class_name;
        zend_bool retval = 0;
+       zend_class_entry **pce;
+       int class_name_len;
        if (zend_is_callable(callable, 0, callable_name)) {
                return 1;
@@ -2043,14 +2045,20 @@
        switch (Z_TYPE_P(callable)) {
                case IS_STRING:
                        lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
- +
                        if ((func = strstr(lcname, "::")) != NULL) {
-                               zval_dtor(callable);
-                               array_init(callable);
-                               add_next_index_stringl(callable, lcname, func - lcname, 1);
-                               func += 2;
-                               add_next_index_stringl(callable, func, strlen(func), 1);
-                               retval = 1;
+                               *func = '\0';
+                               class_name_len = func - lcname;
+                               class_name = estrndup(Z_STRVAL_P(callable), class_name_len);
+                               if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC) == SUCCESS) {
+                                       zval_dtor(callable);
+                                       array_init(callable);
+                                       add_next_index_stringl(callable, lcname, class_name_len, 1);
+                                       func += 2;
+                                       add_next_index_stringl(callable, func, strlen(func), 1);
+                                       retval = 1;
+                               }
+                               efree(class_name);
                        }
                        efree(lcname);
                        break;
-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.zend-engine.cvs (#3937) next »