[php-src] master: ext/standard: Use append-new insertion when parsing CSV
| From: | Weilin Du | Date: | Thu, 17 Sep 2026 01:38:23 +0000 |
| Subject: | [php-src] master: ext/standard: Use append-new insertion when parsing CSV | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141244@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-09-17T09:38:17+08:00
Commit: https://github.com/php/php-src/commit/a318ae825185d17cd529fe0fe5a3f8159f910d3a
Raw diff: https://github.com/php/php-src/commit/a318ae825185d17cd529fe0fe5a3f8159f910d3a.diff
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.
Changed paths:
M ext/standard/file.c
Diff:
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f33f1585dbf8..fa0d3079bcc4 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);