Ticket #6936 (new defect)

Opened 2 months ago

Last modified 2 months ago

upgrade process fails with WP_User_Search class not found error if __autoload defined

Reported by: ithinkihaveacat Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: Administration Version: 2.5.1
Severity: normal Keywords:
Cc: mjs@beebo.org

Description

If autoload is defined, the upgrade process fails with a WP_User_Search class not found error. This is because wp-admin/includes/user.php does:

if ( !class_exists('WP_User_Search') ) :
class WP_User_Search {
	var $results;
        // ...

If WP_User_Search doesn't exist and autoload is defined autoload is invoked to define the class, which fails. The fix is to include an optional second argument to class_exists:

if ( !class_exists('WP_User_Search', false) ) :
class WP_User_Search {
	var $results;
        // ...

(A patch is attached.)

Attachments

user.patch (362 bytes) - added by ithinkihaveacat on 05/08/08 14:26:30.

Change History

05/08/08 14:26:30 changed by ithinkihaveacat

  • attachment user.patch added.

05/08/08 14:26:47 changed by ithinkihaveacat

  • cc set to mjs@beebo.org.

05/08/08 14:35:06 changed by DD32

  • milestone set to 2.6.

Seems like Stupid PHP to me.. Calling the autoload function is fair enough, but surely it should check again to see if the class was loaded before returning..

Anyway, The $autoload parameter for class_exists was introduced with PHP 5.0.0, I'm not sure what warnings are triggered by calling a function with extra arguements(If any indeed..).