• Resolved Robert Noakes

    (@rnoakes3rd)


    Good Afternoon,

    I’m having an issue with v3.5.2 of the plugin. I’m getting the following error when a user is registered:

    PHP Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /…/wp-content/plugins/wp-members/includes/api/api-utilities.php:325\nStack trace:\n#0 /…/wp-content/plugins/wp-members/includes/api/api-utilities.php(325): fwrite(false, ‘check_folder_for_index(316, ‘logo’, 12543)\n#3 /…/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array)\n#4 /…/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#5 /…/wp-content/plugins/wp-members/includes/class-wp-members-user.php(930): do_action(‘wpmem_file_uplo…’, 316, ‘logo’, 12543)\n#6 /…/wp-content/plugins/wp-members/includes/class-wp-members-user.php(535): WP_Members_User->upload_user_files(316, Array)\n#7 /…/wp-includes/class-wp-hook.php(326): WP_Members_User->register_finalize(316)\n#8 /…/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#9 /…/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#10 /…/wp-includes/user.php(2554): do_action(‘user_register’, 316, Array)\n#11 /…/wp-content/plugins/wp-members/includes/api/api-users.php(781): wp_insert_user(Array)\n#12 /…/wp-content/plugins/wp-members/includes/class-wp-members.php(935): wpmem_user_register(‘register’)\n#13 /…/wp-content/plugins/wp-members/includes/class-wp-members.php(885): WP_Members->get_regchk(‘register’)\n#14 /…/wp-includes/class-wp-hook.php(324): WP_Members->get_action(”)\n#15 /…/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#16 /…/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#17 /…/wp-includes/template-loader.php(13): do_action(‘template_redire…’)\n#18 /…/wp-blog-header.php(19): require_once(‘/nas/content/li…’)\n#19 /…/index.php(17): require(‘/nas/content/li…’)\n#20 {main}\n thrown in /…/wp-content/plugins/wp-members/includes/api/api-utilities.php on line 325, referer: …

    This issue did not occur in earlier versions of the plugin and no changes have been made to the theme in some time.

    Thank you,
    @rnoakes3rd

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Robert Noakes

    (@rnoakes3rd)

    It looks like this issue may be related to image fields. User registration works fine when the image field is left blank. The issue also occurs when trying to upload an image for an existing user. Please let me know if you need any additional information.

    Thank you again,
    @rnoakes3rd

    • This reply was modified 10 months, 3 weeks ago by Robert Noakes.
    Thread Starter Robert Noakes

    (@rnoakes3rd)

    Here’s a cleaned-up version of the error (if it helps):

    PHP Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /…/wp-content/plugins/wp-members/includes/api/api-utilities.php:325
    Stack trace:
    #0 /…/wp-content/plugins/wp-members/includes/api/api-utilities.php(325): fwrite(false, ‘check_folder_for_index(316, ‘logo’, 12543)
    #3 /…/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array)
    #4 /…/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #5 /…/wp-content/plugins/wp-members/includes/class-wp-members-user.php(930): do_action(‘wpmem_file_uplo…’, 316, ‘logo’, 12543)
    #6 /…/wp-content/plugins/wp-members/includes/class-wp-members-user.php(535): WP_Members_User->upload_user_files(316, Array)
    #7 /…/wp-includes/class-wp-hook.php(326): WP_Members_User->register_finalize(316)
    #8 /…/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
    #9 /…/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #10 /…/wp-includes/user.php(2554): do_action(‘user_register’, 316, Array)
    #11 /…/wp-content/plugins/wp-members/includes/api/api-users.php(781): wp_insert_user(Array)
    #12 /…/wp-content/plugins/wp-members/includes/class-wp-members.php(935): wpmem_user_register(‘register’)
    #13 /…/wp-content/plugins/wp-members/includes/class-wp-members.php(885): WP_Members->get_regchk(‘register’)
    #14 /…/wp-includes/class-wp-hook.php(324): WP_Members->get_action(”)
    #15 /…/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
    #16 /…/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #17 /…/wp-includes/template-loader.php(13): do_action(‘template_redire…’)
    #18 /…/wp-blog-header.php(19): require_once(‘/nas/content/li…’)
    #19 /…/index.php(17): require(‘/nas/content/li…’)
    #20 {main}
    thrown in /…/wp-content/plugins/wp-members/includes/api/api-utilities.php on line 325, referer: …

    Plugin Author Chad Butler

    (@cbutlerjr)

    Sorry for the late reply – I have been locked out of wordpress.org due to phone issues, which happens to be my 2FA device.

    Thanks for reporting this. What it appears to be is an issue with file upload. An image field in your registration form or a file field are both essentially the same thing – they upload a file on form submit.

    The error is thrown because it’s not able to write the index file that protects viewing an unprotected directory. When a file is uploaded, it checks the upload folder to make sure it has an index.php and if not, it creates one.

    To get this error, the file does not exist, so it’s trying to create it, but it can’t create it. This is likely a directory permissions issue and, related, what system user the webserver is operating under (user in terms of the server and its filesystem, not WP and its users).

    Since I can’t reproduce this issue locally, it’s localized to your setup’s configuration. I’ll need to know the chmod settings for your WP uploads folder and the existing /wpmembers/ folder (and subfolders) beneath it.

    Thread Starter Robert Noakes

    (@rnoakes3rd)

    @cbutlerjr,

    Thank you for your response. The site is hosted on WPEngine, so I went ahead and reset file permissions there. It appears that this resolved the issue.

    Thank you for your response,
    @rnoakes3rd

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

The topic ‘PHP Fatal error’ is closed to new replies.