summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 60b0948a47..0fd9c04330 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -7042,10 +7042,13 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags, z
&& !zend_is_valid_default_value(type, &value_zv)) {
zend_string *str = zend_type_to_string(type);
if (Z_TYPE(value_zv) == IS_NULL) {
+ ZEND_TYPE_FULL_MASK(type) |= MAY_BE_NULL;
+ zend_string *nullable_str = zend_type_to_string(type);
+
zend_error_noreturn(E_COMPILE_ERROR,
"Default value for property of type %s may not be null. "
- "Use the nullable type ?%s to allow null default value",
- ZSTR_VAL(str), ZSTR_VAL(str));
+ "Use the nullable type %s to allow null default value",
+ ZSTR_VAL(str), ZSTR_VAL(nullable_str));
} else {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use %s as default value for property %s::$%s of type %s",