Title: PHP Fatal error: Uncaught TypeError: Illegal offset type
Last modified: June 15, 2022

---

# PHP Fatal error: Uncaught TypeError: Illegal offset type

 *  Resolved [marcqdigital](https://wordpress.org/support/users/marcqdigital/)
 * (@marcqdigital)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-typeerror-illegal-offset-type/)
 * I’m seeing this message in my site logs a lot:
 *     ```
       PHP Fatal error:  Uncaught TypeError: Illegal offset type in isset or empty in /code/web/content/plugins/xml-sitemap-feed/controllers/class.xmlsf-sitemap.php:303
       Stack trace:
       #0 /code/web/content/plugins/xml-sitemap-feed/views/feed-sitemap-posttype.php(13): XMLSF_Sitemap->prefetch_posts_meta()
       #1 /code/web/wp/wp-includes/template.php(770): require_once('/code/web/conte...')
       #2 /code/web/content/plugins/xml-sitemap-feed/controllers/functions.shared.php(186): load_template('/code/web/conte...')
       #3 /code/web/wp/wp-includes/class-wp-hook.php(307): xmlsf_load_template(false, 'sitemap-posttyp...')
       #4 /code/web/wp/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
       #5 /code/web/wp/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
       #6 /code/web/wp/wp-includes/functions.php(1604): do_action('do_feed_sitemap...', false, 'sitemap-posttyp...')
       #7 /code/web/wp/wp-includes/template-loader.php(48): do_feed()
       #8 /code/web/wp/wp-blog-header.php(19): require_once('/code/web/wp/wp...')
       #9 /code/web/index.php(5): require('/code/web/wp/wp...')
       #10 {main}
         thrown in /code/web/content/plugins/xml-sitemap-feed/controllers/class.xmlsf-sitemap.php on line 303
       ```
   
 * What can I do to fix?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-typeerror-illegal-offset-type/#post-15741100)
 * Hi,
 * Do you know when this error occurs exactly? Are you seeing any sitemaps that 
   do not work? Is your site using a custom post type?
 * The issue it may be the same as discussed on [https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/](https://wordpress.org/support/topic/compatible-with-wordpress6-0-php-8-0/)
   where I have suggested a fix. It seems to have worked and the fix will be integrated
   into the next release. You can wait for it to arrive, or follow the instructions
   on the other thread to apply the fix on your site already.
 * Please let me know 🙂
 *  Thread Starter [marcqdigital](https://wordpress.org/support/users/marcqdigital/)
 * (@marcqdigital)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-typeerror-illegal-offset-type/#post-15741227)
 * Hi Rolf,
 * Thank you so much for your quick response! The sitemap was loading the main page
   but yielding empty results for all post pages. The other thread you linked to
   was the fix though, thank you! I’ve got it in place for now and looking forward
   to the next update.
 * I also have an error for the /sitemap-posttype-page.xml that looks like this:
   PHP Fatal Error · Allowed memory size of 536870912 bytes exhausted (tried to 
   allocate 20480 bytes). The pages xml page displays an error currently. I only
   have 70 some pages, seems strange to me?
 *  Plugin Author [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-typeerror-illegal-offset-type/#post-15768471)
 * > I also have an error for the /sitemap-posttype-page.xml that looks like this:
   > PHP Fatal Error · Allowed memory size of 536870912 bytes exhausted (tried to
   > allocate 20480 bytes). The pages xml page displays an error currently. I only
   > have 70 some pages, seems strange to me?
 * Yes, that does seem strange. Normally, such a low number of pages should not 
   cause such a high memory usage. More than 512MB is a lot.
 * You can try deactivating “expensive” options like “Automatic priority calculation”
   and “Update the Last Changed date on each new comment.” If that is not enough,
   set Image tags to None.
 * Still, it is strange that the sitemap would run out or 512MB… Maybe there is 
   a conflict with another plugin (or your theme) but it will be hard to figure 
   that out without disabling all other plugins. Not recommended on a live site 
   😉

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Fatal error: Uncaught TypeError: Illegal offset type’ is closed to
new replies.

 * ![](https://ps.w.org/xml-sitemap-feed/assets/icon-128x128.png?rev=1112143)
 * [XML Sitemap & Google News](https://wordpress.org/plugins/xml-sitemap-feed/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/xml-sitemap-feed/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/xml-sitemap-feed/)
 * [Active Topics](https://wordpress.org/support/plugin/xml-sitemap-feed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/xml-sitemap-feed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/xml-sitemap-feed/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-typeerror-illegal-offset-type/#post-15768471)
 * Status: resolved