php-html-parser
php-html-parser copied to clipboard
Object destruction hangs during shutdown
I have some issues with script timeouts using this library.
PHP Version => 7.4.10 paquettg/php-html-parser => 3.1.0
I have basic script:
use PHPHtmlParser\Dom;
$dom = new Dom;
$dom->loadFromUrl('http://www.google.com');
$links = $dom->find("a");
echo "done";
After printing "done" it took around 20 seconds to finish script execution I tried to run it from the console and from the web and the results are the same.
When I load a bigger page, it hangs up. Removing __destruct()
from AbstractNode
solves this issue, but I'm not sure if it is a good solution.
Interesting, I guess the destruct of the tree is taking a bit of time for large pages, 20 seconds is a lot. I am thinking of having a configuration option to turn off the destruct functionality, that would help resolve this problem and be backwards compatible.
I wonder why the destruct is so heavy.
I can confirm this.
![](https://snipboard.io/zrNWAb.jpg)