summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2014-11-23 21:09:31 +0100
committerBob Weinand <bobwei9@hotmail.com>2014-11-23 21:10:41 +0100
commit5ef138b0c7c4e9532e205f45c18a72aa1d279c24 (patch)
tree63ceccb0fe0d24bfd2f634b1d05621ebcf604df4 /Zend/zend_compile.c
parentc8dd41554387e100a09811cad7f7032a291a79c2 (diff)
downloadphp-git-5ef138b0c7c4e9532e205f45c18a72aa1d279c24.tar.gz
Fix bug #68446 (bug with constant defaults and type hints)
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 8e416ea0a5..e023b24a8e 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1931,8 +1931,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
if (class_type->u.constant.type == IS_ARRAY) {
cur_arg_info->type_hint = IS_ARRAY;
if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
+ if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) {
+ cur_arg_info->allow_null = (Z_TYPE(initialization->u.constant) != IS_NULL) + 1;
} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
}
@@ -1940,8 +1940,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
} else if (class_type->u.constant.type == IS_CALLABLE) {
cur_arg_info->type_hint = IS_CALLABLE;
if (op == ZEND_RECV_INIT) {
- if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
- cur_arg_info->allow_null = 1;
+ if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) {
+ cur_arg_info->allow_null = (Z_TYPE(initialization->u.constant) != IS_NULL) + 1;
} else {
zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
}