Commit 1faf17b0177 for php.net

commit 1faf17b0177fcb4572e1618475f7570110d884c3
Author: Niels Dossche <7771979+ndossche@users.noreply.github.com>
Date:   Sun Dec 21 13:30:20 2025 -0800

    Use packed fill in scandir() (#20737)

    By preallocating the array to the right size and using a packed fill, we
    can avoid reallocations and use the fastest way to fill the array.

diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 918b92fab45..7c1f8efe688 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -558,11 +558,15 @@ PHP_FUNCTION(scandir)
 		RETURN_FALSE;
 	}

-	array_init(return_value);
+	array_init_size(return_value, n);
+	zend_hash_real_init_packed(Z_ARRVAL_P(return_value));

-	for (i = 0; i < n; i++) {
-		add_next_index_str(return_value, namelist[i]);
-	}
+	ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
+		for (i = 0; i < n; i++) {
+			ZEND_HASH_FILL_SET_STR(namelist[i]);
+			ZEND_HASH_FILL_NEXT();
+		}
+	} ZEND_HASH_FILL_END();

 	if (n) {
 		efree(namelist);