• On a site that uses Polylang (Pro), we get a weird PHP error notification on certain search result pages:

    Warning	Attempt to read property "ID" on int
    Warning	Attempt to read property "post_content" on int

    The error pops up in Relevanssis relevanssi_get_current_language function.

    I’ve tried looking at the posts displayed on the search result page using Relevanssis debug functions and Query Monitor, but can’t find anything strange-looking.

    Any idea what I should be looking for?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Can you get the full callstack? That would help.

    The second one cannot be coming directly from the relevanssi_get_current_language(), because the function does not reference $post->post_content anywhere in it.

    In any case, those warnings come from when someone is assuming there’s a post object, but instead there’s a post ID. The relevanssi_get_current_language() uses the global $post object, which should always be a proper post object. If it’s an integer, something has gone wrong somewhere else.

    Thread Starter philbee

    (@philbee)

    Thanks Mikko for answering!
    Unfortunately, I have to admit I’m stumped as to how to get the ?full callstack?.

    Plugin Author Mikko Saari

    (@msaari)

    In the server error logs, there might be further information. In the case of a fatal error, you also should get an email to your admin address with the full error message. However, since these are just warnings, that won’t happen.

    Anyway, pretty much all I can say is there are integers where there should be post objects, but with this information, that’s about it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP warning: Attempt to read property “ID” on int’ is closed to new replies.