[php-src] Issue #10620: php 8 - exit() takes a very long time to send response
| From: | fred-gregorio | Date: | Sun, 19 Feb 2023 02:42:20 +0000 |
| Subject: | [php-src] Issue #10620: php 8 - exit() takes a very long time to send response | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243749@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10620
Author: fred-gregorio
### Description
<?php
$stid= [];
$cnt= 0;
set_time_limit(600);
$epg= simplexml_load_file("epg.xml", "SimpleXMLElement", LIBXML_NOCDATA);
if ($epg === FALSE)
exit ( "Malformed XML" );
foreach ($epg->programme as $p) {
/* just do something.... */
$ev= json_decode(json_encode($p), true);
$pieces= explode(" ", $ev['@attributes']['start']);
$st= $pieces[0];
$start= strtotime(substr($st, 0, 4)."-".substr($st, 4,
2)."-".substr($st, 6, 2)." ".substr($st, 8, 2).":".substr($st, 10,
2).":".substr($st, 12, 2));
$cnt++;
}
exit ( "Done, $cnt programs loaded" )
?>
This snipet of code takes around 15 seconds to execute and get to the exit() line. Existing,
however, takes 10minutes, until the response is sent. The input file (epg.xml) has around 330,000
nodes. The actual code inside the foreach() loop doesn't realy matters much.
Tested with 8.1.14 and 8.2.3 - Same result on both.
Executing the same code with php 7.4.28 works fine, taking around 15 seconds to execute and spit out
the response.
Relevant php configs : max_memory= 256M
Test environment: laptop HP, i7 8th Gen, 32GB RAM, 2TB nVme, Windows 11 PRO - 64 bits
The input file (epg.xml) is provided gz compressed.
[epg.xml.gz](https://github.com/php/php-src/files/10775562/epg.xml.gz)
### PHP Version
8.2.3
### Operating System
Windos 11 64bits