diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-24 16:36:25 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-25 16:31:45 +0200 |
| commit | f1848a4b3f807d21415c5a334b461d240b2a83af (patch) | |
| tree | 9ab6c3a2da4518cdc8a06893890ea0ca8c174c42 /Zend/zend_inheritance.c | |
| parent | 4d8541debbc4f2387879a872b42604ed8b908f58 (diff) | |
| download | php-git-f1848a4b3f807d21415c5a334b461d240b2a83af.tar.gz | |
Fix bug #78226: Don't call __set() on uninitialized typed properties
Assigning to an uninitialized typed property will no longer trigger
a call to __set(). However, calls to __set() are still triggered if
the property is explicitly unset().
This gives us both the behavior people generally expect, and still
allows ORMs to do lazy initialization by unsetting properties.
For PHP 8, we should fine a way to forbid unsetting of declared
properties entirely, and provide a different way to achieve lazy
initialization.
Diffstat (limited to 'Zend/zend_inheritance.c')
| -rw-r--r-- | Zend/zend_inheritance.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index c7002d313f..56d9e6268f 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1167,7 +1167,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par do { dst--; src--; - ZVAL_COPY_VALUE(dst, src); + ZVAL_COPY_VALUE_PROP(dst, src); } while (dst != end); pefree(src, ce->type == ZEND_INTERNAL_CLASS); end = ce->default_properties_table; @@ -1182,7 +1182,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par do { dst--; src--; - ZVAL_COPY_OR_DUP(dst, src); + ZVAL_COPY_OR_DUP_PROP(dst, src); if (Z_OPT_TYPE_P(dst) == IS_CONSTANT_AST) { ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; } @@ -1192,7 +1192,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par do { dst--; src--; - ZVAL_COPY(dst, src); + ZVAL_COPY_PROP(dst, src); if (Z_OPT_TYPE_P(dst) == IS_CONSTANT_AST) { ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; } |
