@@ -1746,6 +1746,27 @@ ZEND_API inheritance_status zend_verify_property_hook_variance(const zend_proper
1746
1746
return zend_perform_covariant_type_check (ce , prop_info -> type , ce , value_arg_info -> type );
1747
1747
}
1748
1748
1749
+ #ifdef ZEND_OPCACHE_SHM_REATTACHMENT
1750
+ /* Hooked properties set get_iterator, which causes issues on for shm
1751
+ * reattachment. Avoid early-binding on Windows and set get_iterator during
1752
+ * inheritance. The linked class may not use inheritance cache. */
1753
+ static void zend_link_hooked_object_iter (zend_class_entry * ce ) {
1754
+ if (!ce -> get_iterator && ce -> num_hooked_props ) {
1755
+ ce -> get_iterator = zend_hooked_object_get_iterator ;
1756
+ ce -> ce_flags &= ~ZEND_ACC_CACHEABLE ;
1757
+ if (CG (current_linking_class ) == ce ) {
1758
+ # if ZEND_DEBUG
1759
+ /* This check is executed before inheriting any elements that can
1760
+ * track dependencies. */
1761
+ HashTable * ht = (HashTable * )ce -> inheritance_cache ;
1762
+ ZEND_ASSERT (!ht );
1763
+ # endif
1764
+ CG (current_linking_class ) = NULL ;
1765
+ }
1766
+ }
1767
+ }
1768
+ #endif
1769
+
1749
1770
ZEND_API void zend_do_inheritance_ex (zend_class_entry * ce , zend_class_entry * parent_ce , bool checked ) /* {{{ */
1750
1771
{
1751
1772
zend_property_info * property_info ;
@@ -3422,7 +3443,7 @@ static zend_class_entry *zend_lazy_class_load(zend_class_entry *pce)
3422
3443
return ce ;
3423
3444
}
3424
3445
3425
- #ifndef ZEND_WIN32
3446
+ #ifndef ZEND_OPCACHE_SHM_REATTACHMENT
3426
3447
# define UPDATE_IS_CACHEABLE (ce ) do { \
3427
3448
if ((ce)->type == ZEND_USER_CLASS) { \
3428
3449
is_cacheable &= (ce)->ce_flags; \
@@ -3567,6 +3588,10 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
3567
3588
zend_enum_register_funcs (ce );
3568
3589
}
3569
3590
3591
+ #ifdef ZEND_OPCACHE_SHM_REATTACHMENT
3592
+ zend_link_hooked_object_iter (ce );
3593
+ #endif
3594
+
3570
3595
if (parent ) {
3571
3596
if (!(parent -> ce_flags & ZEND_ACC_LINKED )) {
3572
3597
add_dependency_obligation (ce , parent );
@@ -3855,6 +3880,10 @@ ZEND_API zend_class_entry *zend_try_early_bind(zend_class_entry *ce, zend_class_
3855
3880
zend_begin_record_errors ();
3856
3881
}
3857
3882
3883
+ #ifdef ZEND_OPCACHE_SHM_REATTACHMENT
3884
+ zend_link_hooked_object_iter (ce );
3885
+ #endif
3886
+
3858
3887
zend_do_inheritance_ex (ce , parent_ce , status == INHERITANCE_SUCCESS );
3859
3888
if (parent_ce && parent_ce -> num_interfaces ) {
3860
3889
zend_do_inherit_interfaces (ce , parent_ce );
0 commit comments