summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-01-05 22:45:11 +0000
committerMarcus Boerger <helly@php.net>2004-01-05 22:45:11 +0000
commit18ea05b7461e85ca15cc4f977c828ff014baf751 (patch)
tree5308728b2976df2da8d517ed8c141f455de6689b
parentf16aed2d7a5b3eda8ce017f9a6580c5acebf8f9e (diff)
downloadphp-git-18ea05b7461e85ca15cc4f977c828ff014baf751.tar.gz
Fixed bug #26802
-rwxr-xr-xZend/tests/bug26802.phpt2
-rw-r--r--Zend/zend_execute.c21
2 files changed, 20 insertions, 3 deletions
diff --git a/Zend/tests/bug26802.phpt b/Zend/tests/bug26802.phpt
index 9681e9051e..beb06cdd73 100755
--- a/Zend/tests/bug26802.phpt
+++ b/Zend/tests/bug26802.phpt
@@ -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
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 6b9ad7e771..9e6d3a46e9 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -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);