[wp-trac] [WordPress Trac] #25672: WordPress › Support » How-To and Troubleshooting is_a() causing errors with get_users()
WordPress Trac
noreply at wordpress.org
Wed Oct 23 17:51:50 UTC 2013
#25672: WordPress › Support » How-To and Troubleshooting is_a() causing errors
with get_users()
--------------------------+-----------------------------
Reporter: dgdax | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.6.1
Severity: normal | Keywords: needs-patch
--------------------------+-----------------------------
(copy of post on support forum : [http://wordpress.org/support/topic/is_a-
causing-errors-with-get_users?replies=2#post-4795246] )
Running WordPress with Yii framework sub-site.
Use of is_a() function in capabilities.php (line 486) is causing errors,
since causes instantiation of a WP_User object - which is unknown to Yii.
is_a() was deprecated in PHP 5.0.0 - but did not cause this problem until
PHP 5.3.7, when its behaviour changed: if first argument is not an object,
__autoload() is triggered. (see php manual:
[http://www.php.net/manual/en/function.is-a.php])
Example: error if I use get_users() with the 'all_with_meta' option.
Cause: is_a() called with non-object ($id)
This is at least inefficient - and in my situation fatal! Even when it
works, this generates unnecessary log warnings in many cases (see all the
other posts)
Solution:
replace:
{{{
if ( is_a( $id, 'WP_User' ))
}}}
with:
{{{
if ( $id instanceof WP_User )
}}}
... or equivalent, wherever is_a() may be called with a non-object.
Please can you fix this for increased compatibility in future versions -
both with PHP and all the other plugins!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25672>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list