diff options
author | Andi Gutmans <andi@php.net> | 2002-07-01 15:13:39 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2002-07-01 15:13:39 +0000 |
commit | 57b853c83151af5e50dd3e6e6ed04f22fa31b19c (patch) | |
tree | 5c87d0d0eccb92a46b22d8ad088d63df732318fa /Zend/zend_compile.c | |
parent | e1483035b69bf7d52ea25e17c9b95c4bb4d2dc9b (diff) | |
download | php-git-57b853c83151af5e50dd3e6e6ed04f22fa31b19c.tar.gz |
- Fix bug when acccessing $this not in class scope.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ed573dffb1..49a388e5c0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2216,17 +2216,18 @@ void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS SET_UNUSED(opline_ptr->op2); opline_ptr->op2.u.EA.type = ZEND_FETCH_FROM_THIS; - if ((opline_ptr->op1.op_type == IS_CONST) && zend_hash_exists(&CG(active_class_entry)->private_properties, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len+1)) { - char *priv_name; - int priv_name_length; + if (CG(active_class_entry)) { + if ((opline_ptr->op1.op_type == IS_CONST) && zend_hash_exists(&CG(active_class_entry)->private_properties, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len+1)) { + char *priv_name; + int priv_name_length; - mangle_private_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len); + mangle_private_property_name(&priv_name, &priv_name_length, CG(active_class_entry)->name, CG(active_class_entry)->name_length, opline_ptr->op1.u.constant.value.str.val, opline_ptr->op1.u.constant.value.str.len); - STR_FREE(opline_ptr->op1.u.constant.value.str.val); - opline_ptr->op1.u.constant.value.str.val = priv_name; - opline_ptr->op1.u.constant.value.str.len = priv_name_length; + STR_FREE(opline_ptr->op1.u.constant.value.str.val); + opline_ptr->op1.u.constant.value.str.val = priv_name; + opline_ptr->op1.u.constant.value.str.len = priv_name_length; + } } - *result = opline_ptr->result; return; } |