1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Revert undoing of partial spl_filesystem_object initialization

We're intentionally not initializing spl_filesystem_object.u.dir.entry, as it
will later be initialized, and we don't need to zero the entire buffer anyway.
This commit is contained in:
Ilija Tovilo
2024-10-17 18:35:17 +02:00
parent c82cea0c34
commit 1c542af144

View File

@@ -187,7 +187,11 @@ static zend_object *spl_filesystem_object_new(zend_class_entry *class_type)
{
spl_filesystem_object *intern;
intern = ecalloc(1, sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
intern = emalloc(sizeof(spl_filesystem_object) + zend_object_properties_size(class_type));
/* Avoid initializing the entirety of spl_filesystem_object.u.dir.entry. */
memset(intern, 0,
MAX(XtOffsetOf(spl_filesystem_object, u.dir.entry),
XtOffsetOf(spl_filesystem_object, u.file.escape) + sizeof(int)));
/* intern->type = SPL_FS_INFO; done by set 0 */
intern->file_class = spl_ce_SplFileObject;
intern->info_class = spl_ce_SplFileInfo;