Hidenori ISHIKAWA
Forum Replies Created
-
Thank you for your comment. I should have written the steps to reproduce the problem.
- Use PHP 8.2 or later. Also use latest WordPress and latest Spectra Gutenberg Blocks plugin.
- Use FS_METHOD as direct first.
- Create some blocks with the plugin.
- Change FS_METHOD as ftpext and also specify all necessary defines (such as FTP_USER, FTP_PASS, etc. those are required for FS_METHOD=ftpext).
- Access the site again.
As I wrote above, while initializing the plugin, plugin calls WP_Filesystem() function without any arguments passed to the function. This is the root cause.
By commenting out the code or properly supplying the arguments (i.e. credentials) in ultimate-addons-for-gutenberg/lib/gutenberg-templates/ast-block-plugin-loader.php where it calls WP_Filesystem(), you can bypass the error raised.
So I strongly advise you to fix the code that calls WP_Filesystem() without any credentials. Specification in WordPress codecs also states that you need to supply the credential to this function if the filesystem requires any credentials. FS_METHOD = direct is the only exception that does not require any credentials. You should not blindy suppose that everybody using WordPress uses FS_METHOD = direct.
- This reply was modified 10 months, 2 weeks ago by Hidenori ISHIKAWA.
Following is an extract from PHP error_log.
PHP Fatal error: Uncaught TypeError: ftp_fput(): Argument #1 ($ftp) must be of type FTP\Connection, null given in /DocumentRoot/wp-admin/includes/class-wp-filesystem-ftpext.php:212
Stack trace:
#0 /DocumentRoot/wp-admin/includes/class-wp-filesystem-ftpext.php(212): ftp_fput()
#1 /DocumentRoot/wp-content/plugins/ultimate-addons-for-gutenberg/lib/gutenberg-templates/inc/classes/ast-block-templates-notices.php(36): WP_Filesystem_FTPext->put_contents()
#2 /DocumentRoot/wp-content/plugins/ultimate-addons-for-gutenberg/lib/gutenberg-templates/ast-block-plugin-loader.php(106): Gutenberg_Templates\Inc\Classes\Ast_Block_Templates_Notices->has_file_read_write()
#3 /DocumentRoot/wp-includes/class-wp-hook.php(324): Gutenberg_Templates\Ast_Block_Plugin_Loader->load_classes()
#4 /DocumentRoot/wp-includes/class-wp-h...