[wp-trac] [WordPress Trac] #35480: Some notice and warning in wp_calculate_image_srcset() function media.php
WordPress Trac
noreply at wordpress.org
Fri Jan 15 20:04:31 UTC 2016
#35480: Some notice and warning in wp_calculate_image_srcset() function media.php
--------------------------+-----------------------------
Reporter: overclokk | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 4.4.1
Severity: normal | Keywords:
Focuses: template |
--------------------------+-----------------------------
In a site I'm working I get some notice and warning in file media.php:
{{{
Warning: Illegal string offset 'file' in wp-includes/media.php on line
1088
Notice: Uninitialized string offset: 0 in wp-includes/media.php on line
1088
Warning: Illegal string offset 'width' in wp-includes/media.php on line
1101
Warning: Illegal string offset 'width' in wp-includes/media.php on line
1108
Notice: Uninitialized string offset: 0 in wp-includes/media.php on line
1108
}}}
To solve this I put this line of code to check the variable $image (at
line 1085 just after the foreach) if it is an array:
{{{#!php
<?php
foreach ( $image_sizes as $image ) {
if ( ! is_array( $image ) ) {
continue;
}
}}}
I also add the file patch.
I don't know how it can be reproduced because the site was already built
but with a search on google I found many site with the same problems,
[https://www.google.it/search?site=&source=hp&q=Warning%3A+Illegal+string+offset+%27file%27+in
+wp-
includes%2Fmedia.php+on+line+1088&oq=Warning%3A+Illegal+string+offset+%27file%27+in
+wp-
includes%2Fmedia.php+on+line+1088&gs_l=hp.3..35i39.8478.13471.0.16997.3.3.0.0.0.0.223.525.0j2j1.3.0....0...1.1.64.hp..0.2.300.0.0dnLDXoHrys
here a link to google serp].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35480>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list