Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute.c /tests bug26802.phpt
| From: | Andi Gutmans | Date: | Tue, 06 Jan 2004 02:16:25 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute.c /tests bug26802.phpt | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-6813@lists.php.net to get a copy of this message | ||
Marcus,
Please revert this patch! You can close the bug as bogus. There is no reason this should work and we're not going to check strings at run-time to see if they look like a static function.
If there's a problem with foo::$bar() not working and having worked before then that's a different matter but I see no sane reason to support:
$a = "foo::bar";
$a();
Andi
At 10:45 PM 1/5/2004 +0000, Marcus Boerger wrote:
helly Mon Jan 5 17:45:12 2004 EDTModified files:/ZendEngine2 zend_execute.c /ZendEngine2/tests bug26802.phptLog: Fixed bug #26802 Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.578 ZendEngine2/zend_execute.c:1.579--- ZendEngine2/zend_execute.c:1.578 Mon Jan 5 06:45:46 2004+++ ZendEngine2/zend_execute.c Mon Jan 5 17:45:11 2004 @@ -17,7 +17,7 @@+----------------------------------------------------------------------+*/ -/* $Id: zend_execute.c,v 1.578 2004/01/05 11:45:46 stas Exp $ */ +/* $Id: zend_execute.c,v 1.579 2004/01/05 22:45:11 helly Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -2470,8 +2470,25 @@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);Index: ZendEngine2/tests/bug26802.phpt diff -u ZendEngine2/tests/bug26802.phpt:1.2 ZendEngine2/tests/bug26802.phpt:1.3 --- ZendEngine2/tests/bug26802.phpt:1.2 Mon Jan 5 17:40:24 2004+++ ZendEngine2/tests/bug26802.phpt Mon Jan 5 17:45:11 2004@@ -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 -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php