elementor / static-html-output

Static HTML Output Plugin for WordPress
https://statichtmloutput.com
The Unlicense
124 stars 34 forks source link

CLI Notice and Fatal Error #75

Closed crstauf closed 4 years ago

crstauf commented 4 years ago

When running wp statichtmloutput generate from CLI, there are a couple of errors:

Notice

``` [01-Jun-2020 17:58:04 UTC] PHP Notice: Undefined index: baseUrl in /app/public/wp-content/plugins/static-html-output-plugin/src/Controller.php on line 340 [01-Jun-2020 17:58:04 UTC] PHP Stack trace: [01-Jun-2020 17:58:04 UTC] PHP 1. {main}() /usr/local/bin/wp:0 [01-Jun-2020 17:58:04 UTC] PHP 2. include() /usr/local/bin/wp:4 [01-Jun-2020 17:58:04 UTC] PHP 3. include() phar:///usr/local/bin/wp/php/boot-phar.php:11 [01-Jun-2020 17:58:04 UTC] PHP 4. WP_CLI\bootstrap() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php:27 [01-Jun-2020 17:58:04 UTC] PHP 5. WP_CLI\Bootstrap\LaunchRunner->process() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php:74 [01-Jun-2020 17:58:04 UTC] PHP 6. WP_CLI\Runner->start() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23 [01-Jun-2020 17:58:04 UTC] PHP 7. WP_CLI\Runner->run_command_and_exit() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:1132 [01-Jun-2020 17:58:04 UTC] PHP 8. WP_CLI\Runner->run_command() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:394 [01-Jun-2020 17:58:04 UTC] PHP 9. WP_CLI\Dispatcher\Subcommand->invoke() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php:371 [01-Jun-2020 17:58:04 UTC] PHP 10. call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451}() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451 [01-Jun-2020 17:58:04 UTC] PHP 11. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure:phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:95-102}() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php:451 [01-Jun-2020 17:58:04 UTC] PHP 12. call_user_func:{phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:98}() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:98 [01-Jun-2020 17:58:04 UTC] PHP 13. StaticHTMLOutput\CLI->generate() phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php:98 [01-Jun-2020 17:58:04 UTC] PHP 14. StaticHTMLOutput\Controller->prepare_for_export() /app/public/wp-content/plugins/static-html-output-plugin/src/CLI.php:103 [01-Jun-2020 17:58:04 UTC] PHP 15. StaticHTMLOutput\Controller->logEnvironmentalInfo() /app/public/wp-content/plugins/static-html-output-plugin/src/Controller.php:257 ```

Fatal error

``` PHP Fatal error: Uncaught Exception: Base-URL must be absolute if reference is not fragment-only in /app/public/wp-content/plugins/static-html-output-plugin/vendor/pear/net_url2/Net/URL2.php:888 Stack trace: #0 /app/public/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php(602): Net_URL2->resolve(Object(Net_URL2)) #1 /app/public/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php(256): StaticHTMLOutput\HTMLProcessor->normalizeURL(Object(DOMElement), 'href') #2 /app/public/wp-content/plugins/static-html-output-plugin/src/HTMLProcessor.php(186): StaticHTMLOutput\HTMLProcessor->processLink(Object(DOMElement)) #3 /app/public/wp-content/plugins/static-html-output-plugin/src/SiteCrawler.php(525): StaticHTMLOutput\HTMLProcessor->processHTML('...', '//PLACEHOLDER.w...') #4 /app/public/wp-content/plugins/static-html-output-plugin/src/SiteCrawler.php(378): StaticHTMLOutput\SiteCrawler->loadFileForProcessing() #5 /app/public/wp-content/plugins/static-html-output-plugin/src/SiteCrawler.php(24 in /app/public/wp-content/plugins/static-html-output-plugin/vendor/pear/net_url2/Net/URL2.php on line 888 ```

root:/app/public# wp statichtmloutput options get baseUrl
https://develop.calebstauffer.com
leonstafford commented 4 years ago

Thanks for reporting, @crstauf!

I'm looking into this at the moment. Not isolated the cause yet, but should figure it out.

leonstafford commented 4 years ago

@crstauf - I've got a fix in which looks like it will be fine. Not sure exactly when this broke unfortunately. Have added more integration tests of late, but not been running any end to end tests for a while, which would have caught this... Please try this build and let me know if any warnings/errors persist:

statichtmloutput75cligeneratefix.zip

crstauf commented 4 years ago

@leonstafford There were no errors logged, I received a success message from the command, and the static files appear to have been generated properly. Thanks!

leonstafford commented 4 years ago

@crstauf - w00t! Sorry for that hiccup. Hope to lock down CLI testing again soon to avoid such regressions