• Resolved Keith

    (@sononaco)


    We recently upgraded a client to PHP 8.1 and was receiving this error:

    PHP Fatal error:? Uncaught TypeError: Illegal offset type in isset or empty in /[deleted]/wordpress/wp-content/plugins/query-wrangler/includes/overrides/post_type_archive.php:110

    After doing some debugging it appears that the $post_type being received was an array consisting of [ ‘podcast’, ‘post’ ].

    Line 110 contains:

    if ( isset( $post_type_archives[ $post_type ] ) && $qw_query = qw_get_query( (int) $post_type_archives[ $post_type ] ) ) {

    Which throws the error.

    Adding this fixes it:

    if ( !is_array( $post_type ) && isset( $post_type_archives[ $post_type ] ) && $qw_query = qw_get_query( (int) $post_type_archives[ $post_type ] ) ) {

    Is this the correct approach or did the original designer/developer for the site misuse the post_type tags and should be sending a string rather than array?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jonathan Daggerhart

    (@daggerhart)

    I believe this is a bug. The Field for the post type override allows for checking multiple values, so this handler should account for get_query_var('post_type') to be an array.

    I’ll make a fix and release an update. Might take me ~ an hour or so.

    Plugin Author Jonathan Daggerhart

    (@daggerhart)

    I’ve pushed a fix and created a new release (1.5.53): https://github.com/daggerhart/query-wrangler/pull/25

    Let me know how this works out, and if you have any other issues.

    Thanks!

    Thread Starter Keith

    (@sononaco)

    Good point on the get_query_var function. I was in a hurry and threw together the logical solution.

    Thank you for the quick turnaround! Great plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Illegal offset type in isset or empty in post_type_archive.php’ is closed to new replies.