Title: PHP Error Notice &#8211; String offset cast occurred
Last modified: February 8, 2023

---

# PHP Error Notice – String offset cast occurred

 *  Resolved [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * (@domainsupport)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-error-notice-string-offset-cast-occurred/)
 * Hi,
 * We’re seeing a lot of these in the debug.log …
 *     ```wp-block-code
       [08-Feb-2023 11:15:20 UTC] E_NOTICE: String offset cast occurred in /wp-content/plugins/merge-minify-refresh/merge-minify-refresh.php on line 1064
       ```
   
 * Could you please investigate?
 * Thank you,
 * Oliver
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-error-notice-string-offset-cast-occurred%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [launchinteractive](https://wordpress.org/support/users/launchinteractive/)
 * (@launchinteractive)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/php-error-notice-string-offset-cast-occurred/#post-16464404)
 * Hi Oliver,
 * I’m not getting these errors with PHP 7.4 or 8.1
 * What version of PHP are you using?
 *  Thread Starter [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * (@domainsupport)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/php-error-notice-string-offset-cast-occurred/#post-16464635)
 * Hi,
 * It’s PHP v7.4.32
 * If you cast the string offset to an integer on line 1064 …
 *     ```wp-block-code
       return sprintf('%.' . $decimals . 'f', $bytes / pow(1024, $factor)) . @$sz[(int)$factor];
       ```
   
 * … the PHP doesn’t generate a warning.
 * The reason is that [floor()](https://www.php.net/manual/en/function.floor.php)
   returns an integer as a float and you require an integer to use as the string
   offset.
 * Oliver
 *  Plugin Author [launchinteractive](https://wordpress.org/support/users/launchinteractive/)
 * (@launchinteractive)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/php-error-notice-string-offset-cast-occurred/#post-16467829)
 * Thanks Oliver. I’ve pushed out an update to resolve this.
 *  Thread Starter [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * (@domainsupport)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/php-error-notice-string-offset-cast-occurred/#post-16468548)
 * That’s great, thanks!

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

The topic ‘PHP Error Notice – String offset cast occurred’ is closed to new replies.

 * ![](https://ps.w.org/merge-minify-refresh/assets/icon.svg?rev=3414776)
 * [Merge + Minify + Refresh](https://wordpress.org/plugins/merge-minify-refresh/)
 * [Support Threads](https://wordpress.org/support/plugin/merge-minify-refresh/)
 * [Active Topics](https://wordpress.org/support/plugin/merge-minify-refresh/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/merge-minify-refresh/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/merge-minify-refresh/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/php-error-notice-string-offset-cast-occurred/#post-16468548)
 * Status: resolved