WordPress.org

Ready to get started?Download WordPress

Forums

MimeTypes Link Icons
[resolved] Warning: filesize() [function.filesize]: stat failed (7 posts)

  1. PsychicSmurf
    Member
    Posted 1 year ago #

    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/uploadsn.co.uk/wp-content/uploads/2013/06/example.txt 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):
    /home/crystali/public_html/agnosticpagan/wp-content/uploadsn.co.uk/wp-content/uploads/2013/06/example.txt
    should be
    /home/crystali/public_html/agnosticpagan/wp-content/uploads/2013/06/example.txt

    Somehow an extra "n.co.uk/wp-content/uploads" is getting injected into the path. Any ideas?

    It happens on either my full post page:
    http://agnosticpagan.co.uk/
    or the summary page:
    http://agnosticpagan.co.uk/?page_id=38

    http://wordpress.org/extend/plugins/mimetypes-link-icons/

  2. jrf
    Member
    Plugin Contributor

    Posted 1 year ago #

    Hiya,

    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>';
    }

    Thanks,
    Juliette

  3. PsychicSmurf
    Member
    Posted 1 year ago #

    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:

    Array
    (
        [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] => http://agnosticpagan.co.uk/wp-content/uploads/2013/06
                [subdir] => /2013/06
                [basedir] => /home/crystali/public_html/agnosticpagan/wp-content/uploads
                [baseurl] => http://agnosticpagan.co.uk/wp-content/uploads
                [error] =>
            )
    
        [path_to_home] =>
        [site_root] =>
        [path_to_upload] => /wp-content/uploads
        [test1] =>
        [test2] => n.co.uk/wp-content/uploads/2013/06/example.txt
        [rel_url] => n.co.uk/wp-content/uploads/2013/06/example.txt
    )
  4. PsychicSmurf
    Member
    Posted 1 year ago #

    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:

    http://downloads.wordpress.org/plugin/mimetypes-link-icons.zip

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

  5. jrf
    Member
    Plugin Contributor

    Posted 1 year ago #

    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 );

    with:

    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.

  6. PsychicSmurf
    Member
    Posted 1 year ago #

    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!

  7. jrf
    Member
    Plugin Contributor

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags