WPIntell

Source evidence

PHP Error Notice – String offset cast occurred

Merge + Minify + Refresh · support · 2023-02-08T11:22:00+00:00

mixedsentiment
mediumseverity
0.78relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 29 rows with source links

20.7% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

23 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Oliver Campion resolved
Hi, We’re seeing a lot of these in the debug.log … [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 to see the link] Hi Oliver, I’m not getting these errors with PHP 7.4 or 8.1 What version of PHP are you using? Hi, It’s PHP v7.4.32 If you cast the string offset to an integer on line 1064 … return sprintf('%.' . $decimals . 'f', $bytes / pow(1024, $factor)) . @$sz[(int)$factor]; … the PHP doesn’t generate a warning. The reason is that floor() returns an integer as a float and you require an integer to use as the string offset. Oliver Thanks Oliver. I’ve pushed out an update to resolve this. That’s great, thanks!

Comments

4 shown
launchinteractive 2023-02-13T05:47:00+00:00

Hi Oliver, I’m not getting these errors with PHP 7.4 or 8.1 What version of PHP are you using?

Oliver Campion 2023-02-13T07:43:00+00:00

Hi, It’s PHP v7.4.32 If you cast the string offset to an integer on line 1064 … return sprintf('%.' . $decimals . 'f', $bytes / pow(1024, $factor)) . @$sz[(int)$factor]; … the PHP doesn’t generate a warning. The reason is that floor() returns an integer as a float and you require an integer to use as the string offset. Oliver

launchinteractive 2023-02-14T01:00:00+00:00

Thanks Oliver. I’ve pushed out an update to resolve this.

Oliver Campion 2023-02-14T07:56:00+00:00

That’s great, thanks!