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

Preallocate result array size in simplexml xpath

This is the simplexml version of 4dea42a.
This commit is contained in:
Niels Dossche
2023-09-09 22:59:24 +02:00
parent 0ea268b51a
commit d18bab5562

View File

@@ -1309,7 +1309,8 @@ PHP_METHOD(SimpleXMLElement, xpath)
result = retval->nodesetval;
if (result != NULL) {
array_init(return_value);
array_init_size(return_value, result->nodeNr);
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
for (i = 0; i < result->nodeNr; ++i) {
nodeptr = result->nodeTab[i];