Skip to:
Content

Opened 12 months ago

Closed 11 months ago

Last modified 10 months ago

#3191 closed defect (fixed)

Fatal error: Call to undefined function bbp_new_converter() on first login user after forum conversion

Reported by: jrf Owned by: johnjamesjacoby
Milestone: 2.6 Priority: high
Severity: major Version: trunk
Component: API - Importers Keywords: needs-patch
Cc: johnjamesjacoby

Description

Basics:

  • WP Multisite
  • WP 4.9.x
  • PHP 7.1.x
  • bbPress trunk revision 6777

Situation:

  • Freshly imported phpBB forum (but I don't think the bug is phpBB specific)
  • When an existing (old) forum user tries to login for the first time on the newly converted forum, they are faced with a white screen of death with the below as the underlying error message.
  • This is caused by the old password not having been converted yet and should only happen the first time the user tries to login.
`PHP Fatal error:  Uncaught Error: Call to undefined function bbp_new_converter() in path/to/wp/wp-content/plugins/bbpress/includes/users/functions.php:981
Stack trace:
#0 path/to/wp/wp-includes/class-wp-hook.php(286): bbp_user_maybe_convert_pass('')
#1 path/to/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#2 path/to/wp/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 path/to/wp/wp-content/plugins/bbpress/includes/core/sub-actions.php(256): do_action('bbp_login_form_login')
#4 path/to/wp/wp-includes/class-wp-hook.php(286): bbp_login_form_login('')
#5 path/to/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#6 path/to/wp/wp-includes\plugin.php(453): WP_Hook->do_action(Array)
#7 path/to/wp/wp-login.php(457): do_action('login_form_login')
#8 {main}
  thrown in path/to/wp/wp-content/plugins/bbpress/includes/users/functions on line 981

Trying to fix this with a quick hack - i.e. adding a require_once bbpress()->includes_dir . 'admin/tools/converter.php'; above the problem line - will not work either as for some reason it then *does* trigger the load of the files correctly resulting in a Fatal error: Cannot redeclare bbp_get_converters() (previously declared in ... ) error.

This in turn is, of course, caused by most include/require statements not using include_once/require_once.

I don't have an in-depth understanding of the logic of the file loading used in bbPress, so no patch included unfortunately, but I can't help but wonder why no autoloading mechanism is in place ?

Any help to get this fixed would be greatly appreciated!

Change History (7)

#1 @jrf
12 months ago

Oh and some additional info:

Trying to get round this bug by using a script to just set the WP passwords for all imported users (and mail it to them) will not work either as the bbp_user_maybe_convert_pass() function checks the user meta data and disregards existing WP passwords.

#2 @johnjamesjacoby
12 months ago

  • Milestone changed from Awaiting Review to 2.6
  • Owner set to johnjamesjacoby
  • Priority changed from normal to high

#3 @johnjamesjacoby
12 months ago

  • Resolution set to fixed
  • Status changed from new to closed

In 6785:

Converter: remove WP_SETUP_CONFIG constant setting from converter process.

This introduces a helper database class to avoid directly connecting to the external database. Instead, we'll attempt to control that connection, and provide feedback to the user in the event a connection cannot be made. The WP_SETUP_CONFIG was causing calls to the options API to fail, resulting in broken calculations and invalid offsets.

This commit includes some general load order clean-up, which also fixes a regression causing fatal errors when attempting to upgrade converted user passwords from the old platform. It also fixes the condition where boundaries being converted would display beyond their maximums.

Fixes #3191.

#4 @jrf
12 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Hi @johnjamesjacoby I really appreciate your work on this.
I've just ran some tests however, and I'm still running into the same error when using bbPress revision 6785.

Any more bright ideas ?

#5 @johnjamesjacoby
11 months ago

In 6788:

Converter: add filter to bbp_new_converter().

This change makes it possible to include a custom converter class for the platform being converted from, especially useful if you've changed password storage schemas or want to handle data migration in a way that is specific to your needs.

See #3191.

#6 @johnjamesjacoby
11 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 6789:

Converter: Call bbp_setup_converter() inside of bbp_user_maybe_convert_pass().

This change makes sure the admin-area converter files are included and instantiated from anywhere a user might be logging in from. This fixes a potential fatal error when trying to convert user passwords from old platforms to WordPress after a successful forum conversion has completed.

Fixes #3191.

#7 @jrf
10 months ago

@johnjamesjacoby Hiya, thanks for all your help with this and the additional patches.
I've had a chance to test them in the mean time and AFAICS, things are looking good now, so I've passed it on to the end-user testing again.

Fingers crossed that they won't find anymore issues ;-).

Note: See TracTickets for help on using tickets.