• NEVER CALL WP_Filesystem() WITHOUT ANY ARGUMENTS.

    The root cause is in ultimate-addons-for-gutenberg/lib/gutenberg-templates/ast-block-plugin-loader.php public static function get_filesystem().

    If FS_METHOD is not direct (ftpext for example), WP_Filesystem() returns a filesystem that cannot be accessed. This causes following put_contents() and other APIs to raise error.

    You need to set proper credentials as you do in ultimate-addons-for-gutenberg/classes/class-uagb-filesystem.php public function get_filesystem(). Othewise, check FS_METHOD is direct before you call get_filesystem()->put_contents().

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Hidenori ISHIKAWA

    (@hideishi)

    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...
    Plugin Support BSF- Mohsin Ghouri

    (@mohsinbsf)

    Hi @hideishi,

    Sorry for the inconvenience caused to you.

    I am not able to replicate the issue on my installation. I request you open a support ticket from here:https://wpspectra.com/support/ so that our support dev can check your site configuration and assist you.

    Looking forward to hearing from you.

    Thread Starter Hidenori ISHIKAWA

    (@hideishi)

    @mohsinbsf

    Thank you for your comment. I should have written the steps to reproduce the problem.

    1. Use PHP 8.2 or later. Also use latest WordPress and latest Spectra Gutenberg Blocks plugin.
    2. Use FS_METHOD as direct first.
    3. Create some blocks with the plugin.
    4. 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).
    5. 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.

    Plugin Support BSF- Mohsin Ghouri

    (@mohsinbsf)

    Hi @hideishi,

    Sorry for the inconvenience caused to you.

    I will surely convey your feedback to our concerned developers. We are always keen to listen to our customers and to receive their feedback. This is the best way to improve our products and services and maintain our client’s satisfaction. 🙂

    Have a nice day!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.