Title: Error on PHP 8
Last modified: December 4, 2022

---

# Error on PHP 8

 *  Resolved [John Lewis](https://wordpress.org/support/users/swiftmodders/)
 * (@swiftmodders)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/)
 * Hello,
 * I updated my install on WPEngine to PHP 8 and now I’m getting this error:
 * > `PHP Fatal error: Uncaught TypeError: strcasecmp(): Argument #1 ($string1) 
   > must be of type string, array given in /nas/content/live/swiftmodders/wp-content/
   > plugins/wp-cloudflare-page-cache/libs/cloudflare.class.php:1295\\nStack trace:\\
   > n#0 /nas/content/live/swiftmodders/wp-content/plugins/wp-cloudflare-page-cache/
   > libs/cloudflare.class.php(1295): strcasecmp(Array, '{resp:x-wp-cf-s...')\\n#
   > 1 /nas/content/live/swiftmodders/wp-content/plugins/wp-cloudflare-page-cache/
   > libs/cloudflare.class.php(1578): SWCFPC_Cloudflare->page_cache_test('https://
   > swiftmo...', '')\\n#2 /nas/content/live/swiftmodders/wp-includes/class-wp-hook.
   > php(308): SWCFPC_Cloudflare->ajax_test_page_cache('')\\n#3 /nas/content/live/
   > swiftmodders/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('',
   > Array)\\n#4 /nas/content/live/swiftmodders/wp-includes/plugin.php(517): WP_Hook-
   > >do_action(Array)\\n#5 /nas/content/live/swiftmodders/wp-admin/admin-ajax.php(
   > 188): do_action('wp_ajax_swcfpc_...')\\n#6 {main}\\n thrown in /nas/content/
   > live/swiftmodders/wp-content/plugins/wp-cloudflare-page-cache/libs/cloudflare.
   > class.php on line 1295, referer: https://swiftmodders.com/wp-admin/options-
   > general.php?page=wp-cloudflare-super-page-cache-index`
 * Any ideas?

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

 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16261527)
 * Hi [@swiftmodders](https://wordpress.org/support/users/swiftmodders/),
    That 
   is so wired as I am not seeing that issue on any websites where I am running 
   this plugin. I’m using this plugin on many websites running PHP 8 and 8.1 none
   have this Fatal Error. Are you using the latest version of the plugin?
 *  Thread Starter [John Lewis](https://wordpress.org/support/users/swiftmodders/)
 * (@swiftmodders)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16261546)
 * Hi Saumya,
 * Yes, I am using the latest version of all plugins on my system. I use EDD to 
   sell my products, and people cannot purchase correctly. I could deduce that the
   problem was Super Cache for Cloudflare by testing on my staging environment in
   WPEngine. Since Cloudflare is only enabled in my production environment, I deactivated
   the addon instinctively to test. I noticed orders went through fine in test mode
   without Supercache enabled on PHP 8. However, it did not work in my production
   environment, and I had to downgrade to 7.4 to allow it to work again.
 * I wish I could set up an environment for you to test this yourself, but I do 
   not see how. I cannot upgrade to PHP 8 on my production environment as it will
   cause that same issue again. My staging environment does not have Cloudflare 
   enabled, but I suppose I could set up a Cloudflare account for my staging environment.
 * Let me know what would be helpful to you. I would like to upgrade to PHP 8 in
   the near future. 🙂
 * Thanks,
    John
 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16261864)
 * Hi,
    a couple of questions, 1. Is this issue happening all the time after you
   upgrade to PHP 8 or only when you are Clicking on the “Test Cache” button?
 * Cause looking at the code: [https://plugins.trac.wordpress.org/browser/wp-cloudflare-page-cache/trunk/libs/cloudflare.class.php#L1295](https://plugins.trac.wordpress.org/browser/wp-cloudflare-page-cache/trunk/libs/cloudflare.class.php#L1295)
 * the `$headers['Cache-Control']` should always be a string but for some reason
   in your website, it is returning an Array, I don’t understand why…
 * Can you share your website URL so that I can look at the response header?
    Also
   if somehow you can this following line:
 * `$this->objects['logs']->add_log('test_log', "$headers['Cache-Control'] -> ".
   print_r( $headers['Cache-Control'], true) );`
 * Just above the if block? Also, make sure you have enabled the log mode. Then 
   update to PHP 8 and check the logs to see what Array data it is receiving…
 * You are having this issue because in your case that code is returning an Array
   where it should always be a string.
 *  Thread Starter [John Lewis](https://wordpress.org/support/users/swiftmodders/)
 * (@swiftmodders)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16262103)
 * Hi Saumya,
 * This issue would happen each time I clicked on “Test Cache,” yes. It only happens
   on PHP 8; it does not happen on PHP 7.4.
 * I’ll have to see if there is a way for me to test this because I cannot do this
   on my production install. It breaks EDD, and people cannot purchase from my site.
 * Thanks,
    John
 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16262121)
 * > This issue would happen each time I clicked on “Test Cache,” yes. It only happens
   > on PHP 8; it does not happen on PHP 7.4.
 * – OK. So the plugin is working perfectly but the Test Cache is throwing the error.
   But then again if you don’t use the Test Cache button you should not see this
   error. I told you why the error is coming. So, unless you dig more to see why
   that field is returning an Array when it is supposed to be a string, we won’t
   know for sure.
 * For now, you can refrain from using the Test Cache button and instead check the
   response header directly in the Network tab of the Chrome Dev Tools.
 *  Thread Starter [John Lewis](https://wordpress.org/support/users/swiftmodders/)
 * (@swiftmodders)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16262472)
 * Hi Saumya,
 * Thanks for your help thus far. EDD developers just told me they have an issue
   with PHP 8, which may be related to that. Once they have a fix, I’ll test to 
   see if that was contributing to the issue with Super Cache.
 * Thanks,
    John
 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16264060)
 * OK. Keep me posted.
 *  Thread Starter [John Lewis](https://wordpress.org/support/users/swiftmodders/)
 * (@swiftmodders)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16265160)
 * Hi Saumya,
 * EDD developers have confessed to me that EDD is not fully compatible with PHP
   8. More than likely, my issues stem from that. Until EDD is fully compatible,
   I’ll have to stay on PHP 7.4.
 * Thanks,
    John

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

The topic ‘Error on PHP 8’ 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/)

 * 8 replies
 * 2 participants
 * Last reply from: [John Lewis](https://wordpress.org/support/users/swiftmodders/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/error-on-php-8-6/#post-16265160)
 * Status: resolved