You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use your library together with Laravel and take advantage of Laravel's possibility to start local development server using command php artisan serve I run into an issue where Laravel server gets stuck in an endless loop of calls to simple_html_dom_node->__destruct(). After maximum execution time is exceeded, Laravel server calls:
Laravel development server started: <http://127.0.0.1:8000>
[Thu Jun 14 09:24:43 2018] PHP Fatal error: Maximum execution time of 60 seconds exceeded in C:\Users\[REDACTED]\Desktop\Tests\PHP\blog\blog\vendor\sunra\php-simple-html-dom-parser\Src\Sunra\PhpSimple\simplehtmldom_1_5\simple_html_dom.php on line 140
[Thu Jun 14 09:24:43 2018] PHP Stack trace:
[Thu Jun 14 09:24:43 2018] PHP 1. simplehtmldom_1_5\simple_html_dom_node->__destruct() C:\Users\[REDACTED]\Desktop\Tests\PHP\blog\blog\vendor\sunra\php-simple-html-dom-parser\Src\Sunra\PhpSimple\simplehtmldom_1_5\simple_html_dom.php:0
I debugged the issue for a while but could not resolve it by any other way than to delete/rename/comment-out your destructors in mentioned class.
Minimum, Complete and Verifiable example/Steps to reproduce:
Create Laravel project by running composer create-project --prefer-dist laravel/laravel blog
cd blog and update composer.json with required dependency to your library "sunra/php-simple-html-dom-parser": "^1.5"
Run composer update to fetch newly added dependency.
Open file routes/web.php and update its contents to contain following
use Sunra\PhpSimple\HtmlDomParser;
Route::get('/', function(){
$input = <<<EOM
<!-- PUT YOUR NON-TRIVIAL HTML MARKUP HERE -->
EOM;
$parser = new HtmlDomParser();
$dom = $parser->str_get_html($input);
return view('welcome');
});
(1) Note that <!-- YOUR NON-TRIVIAL HTML MARKUP HERE --> should really be replaced with non-trivial markup, e.g. google.com's source from front-page.
5. Start local development server php artisan serve and access used address (it defaults to 127.0.0.1:8000)
(2) Note I was not able to reproduce it using on PHPv7.1.14 or PHPv7.1, but PHPv7.1.13, PHPv7.1.18 and even PHPv7.2 do suffer from this behavior.
I worked-around this issue by setting up composer script on post-autoload-dump event where I search and destroy (rename) your destructors.
The text was updated successfully, but these errors were encountered:
I'm having the same problem with an endless loop of destructors with HtmlDomParser from WordPress on PHP 7.1.13. The workaround I found was to manually call ->clear() on the DOM element before returning from a function:
functionmodify_content($content) {
$dom = HtmlDomParser::str_get_html($content);
// ...// Add the line below$dom->clear();
return$content;
}
When I use your library together with Laravel and take advantage of Laravel's possibility to start local development server using command
php artisan serve
I run into an issue where Laravel server gets stuck in an endless loop of calls tosimple_html_dom_node->__destruct()
. After maximum execution time is exceeded, Laravel server calls:I debugged the issue for a while but could not resolve it by any other way than to delete/rename/comment-out your destructors in mentioned class.
Minimum, Complete and Verifiable example/Steps to reproduce:
composer create-project --prefer-dist laravel/laravel blog
cd blog
and update composer.json with required dependency to your library"sunra/php-simple-html-dom-parser": "^1.5"
composer update
to fetch newly added dependency.routes/web.php
and update its contents to contain following(1) Note that
<!-- YOUR NON-TRIVIAL HTML MARKUP HERE -->
should really be replaced with non-trivial markup, e.g. google.com's source from front-page.5. Start local development server
php artisan serve
and access used address (it defaults to 127.0.0.1:8000)(2) Note I was not able to reproduce it using on PHPv7.1.14 or PHPv7.1, but PHPv7.1.13, PHPv7.1.18 and even PHPv7.2 do suffer from this behavior.
I worked-around this issue by setting up composer script on
post-autoload-dump
event where I search and destroy (rename) your destructors.The text was updated successfully, but these errors were encountered: