[php-src] PR #13794: Fix GH-13433: Segmentation Fault in zend_class_init_statics when using opcache.preload
| From: | nielsdos | Date: | Sat, 23 Mar 2024 17:12:08 +0000 |
| Subject: | [php-src] PR #13794: Fix GH-13433: Segmentation Fault in zend_class_init_statics when using opcache.preload | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25527@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13794
Author: nielsdos
This regressed in 9a250cc9d6, which allowed static properties to get overridden by a trait during
inheritance. In particular, because of the change to the loop in zend_update_parent_ce(), it's
not guaranteed that all indirects are after one another.
This means that during persisting the zvals of the static members table, some static properties may
be skipped by the current code, which is wrong. In case of the test code, this means that the array
in the trait will keep referring to the old, new freed, stale value. To solve this, we check the
type for IS_INDIRECT, which is the same as what zend_persist_calc() is already doing anyway.
Since 2543e61aed we can check for IS_INDIRECT to see if it should be persisted or not.