summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2013-10-31 08:57:12 +0100
committerBob Weinand <bobwei9@hotmail.com>2013-10-31 08:57:12 +0100
commit2361745806553db9099542d9237ade00dcee799b (patch)
tree8db4023bf325be29ba4f386cb6d1aac4f7911c9a /ext/reflection/php_reflection.c
parent4218e89f8df4ca3897e3aad595e0c2c9cf4c3aca (diff)
downloadphp-git-2361745806553db9099542d9237ade00dcee799b.tar.gz
Working commit for constant scalar expressions (with constants).
Tests will follow.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index cc148b39c5..abebc216c3 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2599,9 +2599,14 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
*return_value = *precv->op2.zv;
INIT_PZVAL(return_value);
- if ((Z_TYPE_P(return_value) & IS_CONSTANT_TYPE_MASK) != IS_CONSTANT
- && (Z_TYPE_P(return_value) & IS_CONSTANT_TYPE_MASK) != IS_CONSTANT_ARRAY) {
- zval_copy_ctor(return_value);
+ switch (Z_TYPE_P(return_value) & IS_CONSTANT_TYPE_MASK) {
+ case IS_CONSTANT:
+ case IS_CONSTANT_ARRAY:
+ case IS_CONSTANT_AST:
+ break;
+
+ default:
+ zval_copy_ctor(return_value);
}
zval_update_constant_ex(&return_value, (void*)0, param->fptr->common.scope TSRMLS_CC);
}
@@ -3414,8 +3419,11 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
/* this is necessary to make it able to work with default array
* properties, returned to user */
- if (Z_TYPE_P(prop_copy) == IS_CONSTANT_ARRAY || (Z_TYPE_P(prop_copy) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
- zval_update_constant(&prop_copy, (void *) 1 TSRMLS_CC);
+ switch (Z_TYPE_P(prop_copy) & IS_CONSTANT_TYPE_MASK) {
+ case IS_CONSTANT:
+ case IS_CONSTANT_ARRAY:
+ case IS_CONSTANT_AST:
+ zval_update_constant(&prop_copy, (void *) 1 TSRMLS_CC);
}
add_assoc_zval(return_value, key, prop_copy);