[php-src] PR #21358: Fix property_info sizing for locally shadowed trait properties

From: Date: Fri, 06 Mar 2026 15:48:39 +0000
Subject: [php-src] PR #21358: Fix property_info sizing for locally shadowed trait properties
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-35108@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/21358 Author: iluuu1994 Previously, static trait properties would always redeclare locally declared static properties to make sure an inherited static property stops sharing a common slot with the parent. This would leave holes in property_info, creating issues for this code: zend_hash_extend(&ce->properties_info, zend_hash_num_elements(&ce->properties_info) + zend_hash_num_elements(&parent_ce->properties_info), 0); where zend_hash_num_elements(&ce->properties_info) + zend_hash_num_elements(&parent_ce->properties_info) is supposed to extend the hash table enough to hold all additional properties coming from parent. However, if ce->properties_info contains holes this might not be enough, given all parent properties are appended at nNumUsed. This could be fixed by further extending the hash table, but we can also avoid the holes in properties_info completely. This is now possible because traits are bound before performing parent class inheritance, declaring the static property and avoiding the defensive copying of these properties. Fixes GH-20672

« previous php.git-pulls (#35108) next »