summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-05-06 21:56:01 +0200
committerNikita Popov <nikic@php.net>2014-05-06 21:56:01 +0200
commit4d8c59f0da439f52a31121a101eef0e5a0faf973 (patch)
tree4b382b69d0e2b0fdb33f8edf211cefb4a072860c /Zend/zend_API.c
parentccc2c8ae165b94765b8dfe62c0a1bab7dabb1e37 (diff)
downloadphp-git-4d8c59f0da439f52a31121a101eef0e5a0faf973.tar.gz
Fix parse_method_params
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 8fc21f1769..f944de9df3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1012,7 +1012,12 @@ ZEND_API int zend_parse_method_parameters(int num_args TSRMLS_DC, zval *this_ptr
zval **object;
zend_class_entry *ce;
- if (!this_ptr || Z_TYPE_P(this_ptr) != IS_OBJECT) {
+ /* Just checking this_ptr is not enough, because fcall_common_helper does not set
+ * Z_OBJ(EG(This)) to NULL when calling an internal function with common.scope == NULL.
+ * In that case EG(This) would still be the $this from the calling code and we'd take the
+ * wrong branch here. */
+ zend_bool is_method = EG(current_execute_data)->function_state.function->common.scope != NULL;
+ if (!is_method || !this_ptr || Z_TYPE_P(this_ptr) != IS_OBJECT) {
RETURN_IF_ZERO_ARGS(num_args, p, 0);
va_start(va, type_spec);