• the wp_create_thumbnail() function in admin_functions.php fails to check filesize of $file before trying to mainpulate $file as an image. If $file is an empty file (because user typoed the filename during upload), this error message is displayed:

    ————————————————–
    Warning: getimagesize(): Read error! in /home/rg/public_html/wordpress/wp-admin/admin-functions.php on line 198

    Warning: getimagesize(): Read error! in /home/rg/public_html/wordpress/wp-admin/admin-functions.php on line 223

    Warning: Division by zero in /home/rg/public_html/wordpress/wp-admin/admin-functions.php on line 241

    Warning: imagecreatetruecolor(): Invalid image dimensions in /home/rg/public_html/wordpress/wp-admin/admin-functions.php on line 245
    File uploaded!

    Your file ifoo.jpg was uploaded successfully!

    Herea€?s the code to display it:

    fff

    Image Details:
    Name:ifoo.jpg
    Size:0 KB
    Type:application/octet-stream

    —————————————–

    division by zero, oh the shame !

    this patch catches the condition and reports a useful error:

    198,204d197
    <
    < if (filesize($file) == 0)
    < {
    < $error = __(‘Uploaded file is 0Kb. Thumbnail not created.’);
    < return $error;
    < }
    <

  • The topic ‘Failure to check upload filesize in wp_create_thumbnail()’ is closed to new replies.