Commit a318ae82518 for php.net
commit a318ae825185d17cd529fe0fe5a3f8159f910d3a
Author: Weilin Du <weilindu@php.net>
Date: Tue Sep 15 15:50:37 2026 +0800
ext/standard: Use append-new insertion when parsing CSV
Parsed fields are appended sequentially to a new array. Use append-new
insertion for the fields and for the single-value blank-line result.
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f33f1585dbf..fa0d3079bcc 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1924,7 +1924,7 @@ PHPAPI HashTable *php_bc_fgetcsv_empty_line(void)
HashTable *values = zend_new_array(1);
zval tmp;
ZVAL_NULL(&tmp);
- zend_hash_next_index_insert(values, &tmp);
+ zend_hash_next_index_insert_new(values, &tmp);
return values;
}
@@ -2183,7 +2183,7 @@ PHPAPI HashTable *php_fgetcsv(php_stream *stream, char delimiter, char enclosure
zval z_tmp;
ZVAL_STRINGL(&z_tmp, temp, comp_end - temp);
- zend_hash_next_index_insert(values, &z_tmp);
+ zend_hash_next_index_insert_new(values, &z_tmp);
} while (inc_len > 0);
efree(temp);