"Call to a member function userGivenName() on null"

  • I'm having a weird issue – it's generating error log messages, but it appears that the admin is working fine.

    The error is:

    1. "Call to a member function userGivenName() on null" at [...]perch/core/runway/apps/content/async/get-lock.php line 39

    It appears to occur when I save a piece of content, for example at the URL:

    1. /perch/core/apps/content/edit/?id=12"

    I'm using a custom auth plugin. Looking in the content_locks table, the userID is 0.

    The immediate trace is:

    1. "[...]perch/core/lib/api/PerchAPI_AuthPlugin.class.php:69",
    2. "[...]perch/core/lib/PerchUsers.class.php:32",
    3. "[...]perch/core/inc/auth_light.php:14",
    4. "[...]perch/core/runway/apps/content/async/get-lock.php:6"

    My resume_session method returns an array (as per the docs https://docs.grabaperch.com/api/auth/) with keys email and role.

    As far as I can tell, if it can't get a lock, then it's looking for a PerchUser object which (obviously) it doesn't have.

    Am I doing something wrong?

  • drewm

    Approved the thread.
  • Looks like the perch3_content_locks table is storing the userID as an int. That seems like a bug.

    If you switch that column to a CHAR(255) does that help at all?

    It may be that the content locking isn't going to work in combination with an authentication plugin at the moment.