Title: Constant error &#8211; array_key_exists(): Argument #2 ($array)
Last modified: June 19, 2025

---

# Constant error – array_key_exists(): Argument #2 ($array)

 *  Resolved [cim](https://wordpress.org/support/users/cim/)
 * (@cim)
 * [11 months, 1 week ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/)
 * What is causing this error I’m seeing in New Relic? Seems to happen only when
   wp-cron.php gets executed. Here’s the full stack trace.
 * Uncaught exception ‘TypeError’ with message ‘array_key_exists(): Argument #2 (
   $array) must be of type array, false given’ in /var/www/html/wp-content/plugins/
   wp-cloudflare-page-cache/libs/fallback_cache.class.php:380
   …che_remove_url_parameters
   called at /var/www/html/wp-content/plugins/wp-cloudflare-page-cache/libs/fallback_cache.
   class.php (461)…et_current_page_cache_key called at /var/www/html/wp-content/
   plugins/wp-cloudflare-page-cache/libs/fallback_cache.class.php (586)…llback_cache_purge_urls
   called at /var/www/html/wp-content/plugins/wp-cloudflare-page-cache/libs/cache_controller.
   class.php (817)…_Controller::purge_urls called at /var/www/html/wp-content/plugins/
   wp-cloudflare-page-cache/libs/cache_controller.class.php (2601)in SWCFPC_Cache_Controller::
   purge_cache_queue_job called at /var/www/html/wp-includes/class-wp-hook.php (
   324)in WP_Hook::apply_filters called at /var/www/html/wp-includes/class-wp-hook.
   php (348)in WP_Hook::do_action called at /var/www/html/wp-includes/plugin.php(
   565)in do_action_ref_array called at /var/www/html/wp-cron.php (191)

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

 *  Plugin Support [Kush](https://wordpress.org/support/users/kushnamdev/)
 * (@kushnamdev)
 * [11 months ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18523479)
 * Hi [@cim](https://wordpress.org/support/users/cim/),
 * Thank you for reaching out.
 * To better assist you, could you please share a few more details about the issue?
   Specifically:
    - Your WordPress and PHP version
    - A list of active plugins and theme
    - Steps to reproduce the issue, if possible
 * This information will help us investigate and provide a more accurate solution.
 * Looking forward to your response.
 * Best regards,
 *  Thread Starter [cim](https://wordpress.org/support/users/cim/)
 * (@cim)
 * [11 months ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18524825)
 * Thanks for the reply. I hope this helps.
 * Versions
    - WordPress: 6.8.1
    - PHP: 8.3.15
 * Plugins
 *     ```wp-block-code
       name,status,update,version,update_version,auto_updateadvanced-custom-fields-pro,active,available,6.4.0.1,6.4.2,offduplicate-page,active,available,4.5.4,4.5.5,offgravityforms,active,none,2.9.10,,ongravityformsmailchimp,active,available,5.6.0,5.7.0,offpost-smtp,active,available,3.1.4,3.3.0,offquery-monitor,inactive,available,3.17.2,3.18.0,offredirection,active,none,5.5.2,,offremove-category-url,active,none,1.1.6,,offsimple-local-avatars,active,none,2.8.3,,offwp-cloudflare-page-cache,active,none,5.0.12,,offsvg-support,active,none,2.5.14,,offwordfence,active,none,8.0.5,,offwordpress-seo,active,available,24.9,25.3.1,offrmg-sso-lemp-1,must-use,,1.0,,offadvanced-cache.php,dropin,,,,offmaintenance.php,dropin,,,,off
       ```
   
 * Theme (Private)
 * WordPress theme including full setup for Tailwind CSS, Sass, PostCSS, Autoprefixer,
   Webpack, TypeScript, Browsersync, imagemin, Prettier, stylelint, ESLint.
 * Reproduce
 * I don’t use curl/wget for the cron but use php cli directly
 *     ```wp-block-code
       */5 * * * * php -d memory_limit=256M /var/www/html/wp-cron.php
       ```
   
 *  Thread Starter [cim](https://wordpress.org/support/users/cim/)
 * (@cim)
 * [11 months ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18526512)
 * Why was this marked as resolved? It clearly isn’t.
 *  Thread Starter [cim](https://wordpress.org/support/users/cim/)
 * (@cim)
 * [10 months, 3 weeks ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18538780)
 * The “fix” is to check if $url_parsed is an array, it’s most likely empty thus
   error hits. You guys might need to thoroughly test this though.
 *     ```wp-block-code
       # wp-cloudflare-page-cache/libs/fallback_cache.class.php:380 - if ( array_key_exists( 'query', $url_parsed ) ) { + if ( is_array( $url_parsed ) && array_key_exists( 'query', $url_parsed ) ) {
       ```
   
 *  Plugin Support [Kush](https://wordpress.org/support/users/kushnamdev/)
 * (@kushnamdev)
 * [10 months ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18566736)
 * [@cim](https://wordpress.org/support/users/cim/) Can you check is the issue is
   still relevant with the latest version of the plugin?
 *  Thread Starter [cim](https://wordpress.org/support/users/cim/)
 * (@cim)
 * [10 months ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18566750)
 * No more issues, thanks [@kushnamdev](https://wordpress.org/support/users/kushnamdev/)!

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

The topic ‘Constant error – array_key_exists(): Argument #2 ($array)’ is closed 
to new replies.

 * ![](https://ps.w.org/wp-cloudflare-page-cache/assets/icon-256x256.gif?rev=3234997)
 * [Super Page Cache – Cloudflare Cache, Page Speed & Core Web Vitals](https://wordpress.org/plugins/wp-cloudflare-page-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cloudflare-page-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [cim](https://wordpress.org/support/users/cim/)
 * Last activity: [10 months ago](https://wordpress.org/support/topic/constant-error-array_key_exists-argument-2-array/#post-18566750)
 * Status: resolved