While testing PHP 8, I discovered that php_phongo_read_preference_prep_tagsets may leak when invoked via php_phongo_readpreference_init_from_hash. This does not happen when called from ReadPreference's constructor, since the "/" modifier in zpp separates the dedicated tagSets zval; however, __set_state does not separate its argument.
Rather than rely on zpp, we can work around the leak by separating the tagSets zval in php_phongo_read_preference_prep_tagsets directly.
This bug likely dates back to PHPC-1206, which is when __set_state was introduced. When was originally implemented in PHPC-851, it was only called from the constructor.
- related to
-
PHPC-1700 prep_tagsets may leak if calling method errors
- Closed