SchumacherFM / wordpress-to-hugo-exporter

Hugo is static site generator written in golang. Wordpress is a tool for remote access to your server ;-) ❗️Contributions welcome!
https://gohugo.io
GNU General Public License v3.0
681 stars 95 forks source link

wp hugo-export: PHP Fatal error: Uncaught Error: Call to a member function export() on null #96

Closed przmv closed 1 year ago

przmv commented 2 years ago

Hello! Thanks for the plugin, but unfortunately it fails to export for me.

Here are a few details:

$ wp --info
OS:     Linux 4.19.0-18-cloud-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php7.4
PHP version:    7.4.25
php.ini used:   /etc/php/7.4/cli/php.ini
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 14.14 Distrib 5.7.36, for Linux (x86_64) using  EditLine wrapper
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /var/www/html
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.5.0

I installed the plugin from master:

$ curl -L -o - https://github.com/SchumacherFM/wordpress-to-hugo-exporter/archive/refs/heads/master.tar.gz | sudo tar xzvf - -C /var/www/html/wp-content/plugins/
$ cd /var/www/html
$ wp plugin activate wordpress-to-hugo-exporter-master

Command line and output:

Debug (commands): Adding command: make-json in i18n Namespace (0.048s)
Debug (commands): Adding command: make-mo in i18n Namespace (0.048s)
Debug (commands): Deferring command: language core (0.049s)
Debug (commands): Deferring command: language plugin (0.049s)
Debug (commands): Deferring command: language theme (0.05s)
Debug (hooks): Immediately invoking on passed hook "after_add_command:site": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/language-command/language-command.php at line 39 (0.05s)
Debug (commands): Adding command: switch-language in site Namespace (0.05s)
Debug (commands): Adding command: language (0.05s)
Debug (hooks): Processing hook "after_add_command:language" with 3 callbacks (0.05s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 644 (0.05s)
Debug (commands): Adding command: core in language Namespace (0.051s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 644 (0.051s)
Debug (commands): Adding command: plugin in language Namespace (0.051s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 644 (0.051s)
Debug (commands): Adding command: theme in language Namespace (0.051s)
Debug (commands): Adding command: maintenance-mode (0.052s)
Debug (commands): Adding command: rewrite (0.052s)
Debug (commands): Adding command: rewrite (0.052s)
Debug (commands): Adding command: cap (0.053s)
Debug (commands): Adding command: role (0.053s)
Debug (commands): Adding command: search-replace (0.055s)
Debug (commands): Adding command: server (0.055s)
Debug (commands): Adding command: shell (0.055s)
Debug (commands): Adding command: super-admin (0.056s)
Debug (commands): Adding command: widget (0.057s)
Debug (commands): Adding command: sidebar (0.057s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/cli.php (0.057s)
Debug (commands): Adding command: cli (0.058s)
Debug (commands): Adding command: cache in cli Namespace (0.059s)
Debug (commands): Adding command: alias in cli Namespace (0.059s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/help.php (0.059s)
Debug (commands): Adding command: help (0.059s)
Debug (bootstrap): No readable global config found (0.06s)
Debug (bootstrap): No project config found (0.06s)
Debug (bootstrap): argv: /usr/local/bin/wp hugo-export --debug (0.06s)
Debug (bootstrap): ABSPATH defined: /var/www/html/ (0.06s)
Debug (bootstrap): Begin WordPress load (0.061s)
Debug (bootstrap): wp-config.php path: /var/www/html/wp-config.php (0.061s)
Debug (commandfactory): No doc comment for hugo-export. (0.192s)
Debug (commands): Adding command: hugo-export (0.193s)
Debug (bootstrap): Loaded WordPress (0.23s)
Debug (hooks): Processing hook "before_run_command" with 1 callbacks (0.23s)
Debug (hooks): On hook "before_run_command": WP_CLI\Bootstrap\RegisterDeferredCommands->add_deferred_commands() (0.23s)
Debug (bootstrap): Running command: hugo-export (0.23s)
PHP Fatal error:  Uncaught Error: Call to a member function export() on null in /var/www/html/wp-content/plugins/wordpress-to-hugo-exporter-master/hugo-export.php:584
Stack trace:
#0 [internal function]: Hugo_Export_Command->__invoke()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func()
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(399): WP_CLI\Dispatcher\Subcommand->invoke()
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(422): WP_CLI\Runner->run_command()
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1194): WP_CLI\Runner->run_command_and_exit()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/w in /var/www/html/wp-content/plugins/wordpress-to-hugo-exporter-master/hugo-export.php on line 584
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

Please let me know if any additional details are necessary.

SchumacherFM commented 2 years ago

Hey, thanks for reporting. Unfortunately I can't help due to less WP knowledge and time in this specific case. Maybe some other can investige why the global variable $je is not correctly instantiated. https://github.com/SchumacherFM/wordpress-to-hugo-exporter/blob/master/hugo-export.php#L584

SchumacherFM commented 1 year ago

closing this due to age. please reopen if the problem still exists.