]> granicus.if.org Git - php/commitdiff
Fixed bug #26802
authorMarcus Boerger <helly@php.net>
Mon, 5 Jan 2004 22:45:11 +0000 (22:45 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 5 Jan 2004 22:45:11 +0000 (22:45 +0000)
Zend/tests/bug26802.phpt
Zend/zend_execute.c

index 9681e9051e949caebce5f0b540df9e4d7b7459a3..beb06cdd735ac3048b52215fce6c2e738c75b9d4 100755 (executable)
@@ -1,5 +1,5 @@
 --TEST--
-#26802 (Can't call static method using a variable)
+Bug #26802 (Can't call static method using a variable)
 --FILE--
 <?php
        
index 6b9ad7e7715765da55315e9c494fcd89cc740ff0..9e6d3a46e9e7fcb57697546ae445054d3444292c 100644 (file)
@@ -2470,8 +2470,25 @@ int zend_init_fcall_by_name_handler(ZEND_OPCODE_HANDLER_ARGS)
 
        lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
        if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) {
-               efree(lcname);
-               zend_error(E_ERROR, "Call to undefined function %s()", function_name_strval);
+               char *method;
+               zend_class_entry **pce;
+
+               if ((method = strstr(lcname, "::")) != NULL) {
+                       *method = '\0';
+                       method +=2;
+                       if (zend_lookup_class(lcname, strlen(lcname), &pce TSRMLS_CC) == SUCCESS) {
+                               if (zend_hash_find(&(*pce)->function_table, method, strlen(method)+1, (void **) &function) == FAILURE) {
+                                       efree(lcname);
+                                       zend_error(E_ERROR, "Call to undefined method %s()", function_name_strval);
+                               }
+                       } else {
+                               efree(lcname);
+                               zend_error(E_ERROR, "Call to method of undefined class %s()", function_name_strval);
+                       }
+               } else {
+                       efree(lcname);
+                       zend_error(E_ERROR, "Call to undefined function %s()", function_name_strval);
+               }
        }
 
        efree(lcname);