diff options
| author | Felipe Pena <felipe@php.net> | 2008-06-05 19:16:17 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2008-06-05 19:16:17 +0000 |
| commit | 579dcade614af6b6c61112d54019b3e84902bb55 (patch) | |
| tree | 7633752bfe760eb99bb312d7d6996044f23dfb94 | |
| parent | 0e74a12ae1f92784429b1c54dfaafe891753e3d7 (diff) | |
| download | php-git-579dcade614af6b6c61112d54019b3e84902bb55.tar.gz | |
- MFB: Fixed bug #45186 (__call depends on __callstatic in class scope)
| -rw-r--r-- | Zend/zend_API.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 6f56ec9fff..570d8f7bc0 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2802,14 +2802,27 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) { retval = (*ce_ptr)->__call != NULL; *fptr_ptr = (*ce_ptr)->__call; - } else if (!*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__callstatic) { - retval = 1; - *fptr_ptr = (*ce_ptr)->__callstatic; } else { - if (*ce_ptr) { - if (error) zend_spprintf(error, 0, "class '%v' does not have a method '%v'", (*ce_ptr)->name, lmname); - } else { - if (error) zend_spprintf(error, 0, "function '%v' does not exist", lmname); + if (!*zobj_ptr_ptr && *ce_ptr && ((*ce_ptr)->__callstatic || (*ce_ptr)->__call)) { + if ((*ce_ptr)->__call && + EG(This) && + Z_OBJ_HT_P(EG(This))->get_class_entry && + instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr TSRMLS_CC)) { + retval = 1; + *fptr_ptr = (*ce_ptr)->__call; + *zobj_ptr_ptr = &EG(This); + } else if ((*ce_ptr)->__callstatic) { + retval = 1; + *fptr_ptr = (*ce_ptr)->__callstatic; + } + } + + if (retval == 0) { + if (*ce_ptr) { + if (error) zend_spprintf(error, 0, "class '%v' does not have a method '%v'", (*ce_ptr)->name, lmname); + } else { + if (error) zend_spprintf(error, 0, "function '%v' does not exist", lmname); + } } } } else { |
