Skip to content

Commit ee41549

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Revert undoing of partial spl_filesystem_object initialization
2 parents 76138d6 + 1c542af commit ee41549

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: ext/spl/spl_directory.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,11 @@ static zend_object *spl_filesystem_object_new(zend_class_entry *class_type)
187187
{
188188
spl_filesystem_object *intern;
189189

190-
intern = ecalloc(1, sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
190+
intern = emalloc(sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
191+
/* Avoid initializing the entirety of spl_filesystem_object.u.dir.entry. */
192+
memset(intern, 0,
193+
MAX(XtOffsetOf(spl_filesystem_object, u.dir.entry),
194+
XtOffsetOf(spl_filesystem_object, u.file.escape) + sizeof(int)));
191195
/* intern->type = SPL_FS_INFO; done by set 0 */
192196
intern->file_class = spl_ce_SplFileObject;
193197
intern->info_class = spl_ce_SplFileInfo;

0 commit comments

Comments
 (0)