[wp-trac] [WordPress Trac] #35340: PHP Fatal Error: Call to undefined method WP_Error::exists()
WordPress Trac
noreply at wordpress.org
Thu Jan 7 01:26:43 UTC 2016
#35340: PHP Fatal Error: Call to undefined method WP_Error::exists()
--------------------------+-----------------------------
Reporter: crackhd | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.4
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
This error happens since update to Wordpress 4.4.0,
my current version is 4.4.1 (not in the list in trac)
Log:
[Thu Jan 07 ... 2016] [:error] [pid 21932] [client...] PHP Fatal error:
Call to undefined method WP_Error::exists() in /var/websites/s4mp/wp-
includes/capabilities.php on line 505
Fix:
On line 505 in capabilities.php, change user_can() function from:
```
if ( ! $user || ! $user->exists() )
return false;
```
To:
```
if ( ! $user || $user instanceof WP_Error || ! $user->exists() )
return false;
```
When it happens?
Enable "WP Maintenance mode" (with known plugin), then request password
reset email and follow link. On my current configuration (without changes
to Wordpress code) it raises this error when clicking "Submit" and sending
password reset form.
This of course not happens on clean Wordpress installation, this is list
of my plugins (folder names):
404-error-logger custom-css-js-php
rvg-optimize-database
404-to-start custom-sidebars
site-plugin
are-you-robot-recaptcha disable-search
slate-admin-theme
bbpress easy-fancybox
smart-donations
bbpress-auto-suggest-topics-based-on-new-topic-title easy-wp-smtp
super-socializer
bbpress-mark-as-read email-users
syntax-highlight
bbpress-members-only enhanced-text-widget
tabby-responsive-tabs
bbpress-permalinks-with-id google-analytics-
dashboard-for-wp tablepress
bbpress-post-topics hello.php
twitter-tracker
bbpress-quotes index.php
user-access-manager
bbpress-report-content jetpack
wordpress-seo
bwp-recent-comments jetpack-only-for-
admins wp-security-audit-log
comments-widget-plus login-with-username-
or-email zencache
crayon-syntax-highlighter maintenance
I could not find which of them causes problem exactly but error itself
points to bug in wordpress, i think, because "$user" becomes an instance
of "WP_Errror".
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35340>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list