We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9fffe41 commit 1faf17bCopy full SHA for 1faf17b
1 file changed
ext/standard/dir.c
@@ -558,11 +558,15 @@ PHP_FUNCTION(scandir)
558
RETURN_FALSE;
559
}
560
561
- array_init(return_value);
+ array_init_size(return_value, n);
562
+ zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
563
- for (i = 0; i < n; i++) {
564
- add_next_index_str(return_value, namelist[i]);
565
- }
+ ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
+ for (i = 0; i < n; i++) {
566
+ ZEND_HASH_FILL_SET_STR(namelist[i]);
567
+ ZEND_HASH_FILL_NEXT();
568
+ }
569
+ } ZEND_HASH_FILL_END();
570
571
if (n) {
572
efree(namelist);
0 commit comments