Support » Plugin: MimeTypes Link Icons » Warning: filesize() [function.filesize]: stat failed

  • Resolved PsychicSmurf


    When I have an attachment in a post, and have display filesize enabled, I’m getting:

    Warning: filesize() [function.filesize]: stat failed for /home/crystali/public_html/agnosticpagan/wp-content/ in /home/crystali/public_html/agnosticpagan/wp-content/plugins/mimetypes-link-icons/mime_type_link_images.php on line 1310

    It would seem that the path to the file is getting corrupted (which then makes the function fail):
    should be

    Somehow an extra "" is getting injected into the path. Any ideas?

    It happens on either my full post page:
    or the summary page:

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor jrf



    Thanks for reporting this! I’m going to try and fix this, but need some more info to determine the cause.

    As you have debugging set to true, could you have a look at the bottom of the settings page ? If should have an array with the settings listed.
    Could you check what the value is for “internal_domains” ?

    Also, if you’d be willing to do so, could you temporarily add the following code on line 1290 (empty line just above ‘try and get the filesize’ comment) of the plugins/mimetypes-link-icons/mime_type_link_images.php file and let me know what the output is ?

    if( WP_DEBUG === true ) {
    	print '<pre>';
    	print_r( array(
    		'home_path'	=>	$home_path, 'site_path'	=>	$site_path, 'wp_upload'	=>	$wp_upload, 'path_to_home'	=>	$path_to_home, 'site_root'	=>	$site_root, 'path_to_upload'	=>	$path_to_upload, 'test1'		=>	in_array( substr( $url, 0, 1 ), array( '/', '\\', '.' ) ), 'test2'		=>	$this->is_own_domain( $url ), 'rel_url'	=>	(isset( $rel_url ) ? $rel_url : 'not set'),
    	) );
    	print '</pre>';


    I haven’t enabled WP_DEBUG, and haven’t explicitly changed anything to enable debugging. It’s possible that my php.ini files may have debug out enabled though for my development.

    However, I’ve now just enabled it so we can debug, and the setting page shows:

    [internal_domains] => Array
                [0] => agnosticpaga

    I then added in the temporary code @ line 1290 and it shows:

        [home_path] => /home/crystali/public_html/agnosticpagan/
        [site_path] => /home/crystali/public_html/agnosticpagan/
        [wp_upload] => Array
                [path] => /home/crystali/public_html/agnosticpagan/wp-content/uploads/2013/06
                [url] =>
                [subdir] => /2013/06
                [basedir] => /home/crystali/public_html/agnosticpagan/wp-content/uploads
                [baseurl] =>
                [error] =>
        [path_to_home] =>
        [site_root] =>
        [path_to_upload] => /wp-content/uploads
        [test1] =>
        [test2] =>
        [rel_url] =>

    It may be pertinent, but I tried to download the plugin using the above link, and also through the WP interface, and both gave me 404 File not found.

    I managed to download the plugin using:

    It appears to be the same as the SVN, but thought it may be important to mention.

    Plugin Contributor jrf


    I just noticed the same (404), will check in with Toby about that.

    In the mean time, could you try the following:

    In file mimetypes-link-icons/mime_type_link_images.php, replace line 1310:

    return filesize( $this->sync_dir_sep( $wp_upload['basedir'] ) . $rel_url );


    return filesize( $this->sync_dir_sep( $wp_upload['basedir'] ) . substr( $rel_url, ( stripos( $rel_url, $path_to_upload ) + strlen( $path_to_upload ) ) ) ) );

    From your debug values I can see something is going wrong with the internal domain value, will look into that as well, but I kind of hope that the above change will fix the error for now.

    Let me know how you get on! Thanks.

    Yes, that has fixed the issue my end! Many thanks.

    I’ll tag this as resolved and leave the other investigations to you 🙂

    Many thanks for a swift fix, and a very useful plugin!

    Plugin Contributor jrf


    Excellent! Glad to hear that solved the issue and I’ll make sure the fix makes it into the next version.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Warning: filesize() [function.filesize]: stat failed’ is closed to new replies.