简体   繁体   中英

Error with Amazon S3 for WordPress

I am using a great Wordpress to store files on Amazon S3 called "Amazon S3 for WordPress" it seems to have a bug with version 3.0+ of Wordpress.

The error I am getting is:

Warning: strpos() expects parameter 1 to be string, array given in /home/dir/public_html/www.site.com/wp-admin/includes/media.php on line 310

Here is the code in media.php around line 310:

wp_enqueue_style( 'global' );
wp_enqueue_style( 'wp-admin' );
wp_enqueue_style( 'colors' );
// Check callback name for 'media'
if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) ) || 0 === strpos( $content_func, 'media' ) )
    wp_enqueue_style( 'media' );
wp_enqueue_style( 'ie' );

I would love some clue as to what is going on.

Thanks

Actually, I think you've found a bug in WordPress. The line of code that's throwing the error is this:

if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) ) || 0 === strpos( $content_func, 'media' ) )

If you look at that, the second scenario assumes $content_func is a string and passes it through strpos

Maybe something like

if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) ) || ( is_string( $content_func ) && 0 === strpos( (string)$content_func, 'media' ) ) )

Would work better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM