WordPress.org

Support

Support » How-To and Troubleshooting » is_a() causing errors with get_users()

is_a() causing errors with get_users()

  • 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)

    Example: error if I use get_users() with the ‘all_with_meta’ option.

    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 )

    Please can you fix this for increased compatibility in future versions – both with PHP and all the other plugins!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_a() causing errors with get_users()’ is closed to new replies.
Skip to toolbar