Title: PHP Warning in optimize.cls.php
Last modified: November 4, 2020

---

# PHP Warning in optimize.cls.php

 *  Resolved [nir0ma](https://wordpress.org/support/users/nir0ma/)
 * (@nir0ma)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/)
 * Hi,
 * I’m running litespeed cache v3.5.2 and I’ve got these warnings in litespeed-toolbox#
   log_viewer :
 * PHP Warning: strpos() expects parameter 1 to be string, array given in wp-content/
   plugins/litespeed-cache/src/optimize.cls.php on line 231
 * PHP Warning: strpos() expects parameter 1 to be string, array given in wp-content/
   plugins/litespeed-cache/src/optimize.cls.php on line 227
 * EDIT : Also got this notice : Array to string conversion in wp-content/plugins/
   litespeed-cache/src/css.cls.php on line 390
 * Have a nice day !
    -  This topic was modified 5 years, 6 months ago by [nir0ma](https://wordpress.org/support/users/nir0ma/).

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

 *  [florinb1](https://wordpress.org/support/users/aventurescu/)
 * (@aventurescu)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13623266)
 * Hi,
 * Same issue here.
 * [05-Nov-2020 07:38:42 Europe/Bucharest] PHP Warning: strpos() expects parameter
   1 to be string, array given in /wp-content/plugins/litespeed-cache/src/optimize.
   cls.php on line 227
    [05-Nov-2020 07:38:42 Europe/Bucharest] PHP Warning: strpos()
   expects parameter 1 to be string, array given in /wp-content/plugins/litespeed-
   cache/src/optimize.cls.php on line 231
 * THanks
 *  Plugin Support [Hai Zheng⚡](https://wordpress.org/support/users/hailite/)
 * (@hailite)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13626497)
 * Are you able to reproduce it?
 *  [jonas8686](https://wordpress.org/support/users/jonas8686/)
 * (@jonas8686)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13638329)
 * Hi, Same issue here… (WP:5.5.3 PHP:7.4)
    [09-Nov-2020 10:56:20 UTC] PHP Warning:
   parse_url() expects parameter 1 to be string, array given in /home/site/public_html/
   wp-content/plugins/litespeed-cache/src/utility.cls.php on line 707 [09-Nov-2020
   10:56:20 UTC] PHP Warning: parse_url() expects parameter 1 to be string, array
   given in /home/site/public_html/wp-content/plugins/litespeed-cache/src/css.cls.
   php on line 388 [09-Nov-2020 10:56:20 UTC] PHP Warning: substr() expects parameter
   1 to be string, array given in /home/site/public_html/wp-content/plugins/litespeed-
   cache/src/css.cls.php on line 391
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13641455)
 * Hi,
 * could you please edit this file
 * /home/site/public_html/wp-content/plugins/litespeed-cache/src/utility.cls.php
 * on line 707, you will see
 * $url_parsed = parse_url( $url );
 * please add this line ABOVE it
 * error_log($url,3,”/home/site/public_html/lscwp.log”);
 * then reproduce that error , and see what content is logged into lscwp.log ?
 * Best regards,
 *  Thread Starter [nir0ma](https://wordpress.org/support/users/nir0ma/)
 * (@nir0ma)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13643348)
 * Hi,
    Here is the log :
 *     ```
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       https://domain.com/wp-content/themes/themename/custom.js
       https://c0.wp.com/p/jetpack/9.0.2/_inc/build/photon/photon.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/wp-embed.min.js
       https://c0.wp.com/c/5.5.3/wp-includes/js/comment-reply.min.js
       ```
   
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13646625)
 * Hi,
 * well , sorry , the log is bit of mess and hard to determinate which round was
   it
 * please change
 * `error_log($url,3,"/home/site/public_html/lscwp.log");`
 * to
 *     ```
       error_log("start\n",3,"/home/site/public_html/lscwp.log");
       error_log($url,3,"/home/site/public_html/lscwp.log");
       error_log("\nend",3,"/home/site/public_html/lscwp.log");
       ```
   
 * clean up current lscwp.log file and repeat the process
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13680087)
 * Hi,
 * I’m going to mark this topic “Resolved”, due to lack of activity.
 * If you still need help, please feel free to re-open it.
 * Best regards,
 *  [Alex Kladov](https://wordpress.org/support/users/prowebassist/)
 * (@prowebassist)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13721842)
 * I’ve got the same errors being logged over and over too:
 *     ```
       [29-Nov-2020 12:30:24 UTC] PHP Warning:  strpos() expects parameter 1 to be string, array given in /home/website/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php on line 227
       [29-Nov-2020 12:30:24 UTC] PHP Warning:  strpos() expects parameter 1 to be string, array given in /home/website/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php on line 227
       [29-Nov-2020 12:30:24 UTC] PHP Warning:  strpos() expects parameter 1 to be string, array given in /home/website/public_html/wp-content/plugins/litespeed-cache/src/optimize.cls.php on line 231
       ```
   
 * Running PHP v7.4, WP v5.5.3 & LiteSpeed Cache v3.5.2
 *  [florinb1](https://wordpress.org/support/users/aventurescu/)
 * (@aventurescu)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13908753)
 * Same error here

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

The topic ‘PHP Warning in optimize.cls.php’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 9 replies
 * 6 participants
 * Last reply from: [florinb1](https://wordpress.org/support/users/aventurescu/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/php-warning-in-optimize-cls-php/#post-13908753)
 * Status: resolved