summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2002-01-14 16:55:23 +0000
committerAndi Gutmans <andi@php.net>2002-01-14 16:55:23 +0000
commit65f01545a86b7e8eff264e30ffb22372e8ca7784 (patch)
tree927d0e3986ee861d332724d419953ed0d0955314
parent3acaa30c1c56108f48d33c5f01510a34d4dfcbf2 (diff)
downloadphp-git-65f01545a86b7e8eff264e30ffb22372e8ca7784.tar.gz
- Fix crash bug in call_user_function_ex(). Thanks to Sebastian for the
- very nice and short reproducing script. <?php $array = array('foo', 'bar'); uasort($array, 'cmp'); function cmp($a, $b) { return (strcmp($a[1], $b[1])); } ?>
-rw-r--r--Zend/zend_execute_API.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 0a3892bac8..8927b37084 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -545,9 +545,10 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
EG(namespace) = calling_namespace;
current_this = EG(this);
- EG(this) = *object_pp;
- if (EG(this)) {
+ if (object_pp) {
+ EG(this) = *object_pp;
+
if (!PZVAL_IS_REF(EG(this))) {
EG(this)->refcount++; /* For $this pointer */
} else {
@@ -559,6 +560,8 @@ int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *fun
zval_copy_ctor(this_ptr);
EG(this) = this_ptr;
}
+ } else {
+ EG(this) = NULL;
}