Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-14291

Function send_file_to_browser() endlessly overwrites 'filesize' in ATTACHMENTS_TABLE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 3.1.10-RC1
    • 3.1.6, 3.2.0-dev
    • Viewing posts
    • None
    • PHP 5.6, MySQL 5.6, Firefox 44

      This issue relates to the image attachments with thumbnails.

      How to reproduce:
      + open any page containing an attachment thumbnail,
      + open that attachment in its full size in another browser window,
      + refresh that two pages alternately, emulating the activity of several users.
      Filesize will be overwritten every time, from full image size to thumbnail size and vice versa.

      This doesn’t affect viewing/downloading process, but filesize information, displayed on board pages, becomes inconstant and incorrect.

      Possible fix:

      --- includes/functions_download.php
      +++ includes/functions_download.php
      @@ -165,7 +165,7 @@
       	}
       
       	// Make sure the database record for the filesize is correct
      -	if ($size > 0 && $size != $attachment['filesize'])
      +	if ($size > 0 && $size != $attachment['filesize'] && strpos($attachment['physical_filename'], 'thumb_') === false)
       	{
       		// Update database record
       		$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
      
      

            Marc Marc
            Nekstati Nekstati
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: