Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11145

ATTACHED_IMAGE_NOT_IMAGE thrown because of file limit in php.ini

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.10, 3.0.11
    • Fix Version/s: 3.0.12-RC1
    • Component/s: Posting
    • Labels:
      None
    • Environment:
      PHP Version 5.3.3-7+squeeze8 (Debian) but also on PHP Version 5.3.13 (Windows)

      Description

      When I try to upload an image (2,3 MB) that is bigger than the upload limit in php.ini (2 MB) a wrong error is thrown. This is caused by the following code in includes/functions_posting.php:

      includes/functions_posting.php

      	
      // Make sure the image category only holds valid images...
      if ($cat_id == ATTACHMENT_CATEGORY_IMAGE && !$file->is_image())
      {
      	$file->remove();
       
      	// If this error occurs a user tried to exploit an IE Bug by renaming extensions
      	// Since the image category is displaying content inline we need to catch this.
      	trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
      }
      

      When I print the $file object, the real error reveals itself:

      filespec Object
      (
          [filename] => 
          [realname] => 300sl_coupe.png
          [uploadname] => 300sl_coupe.png
          [mimetype] => application/octetstream
          [extension] => png
          [filesize] => 0
          [width] => 0
          [height] => 0
          [image_info] => Array
              (
              )
       
          [destination_file] => 
          [destination_path] => 
          [file_moved] => 
          [init_error] => 
          [local] => 
          [error] => Array
              (
                  [0] => The attachment's file size is too large, the maximum upload size is 2 MB.<br />Please note this is set in php.ini and cannot be overridden.
              )
       
          [upload] => fileupload Object
              (
                  [allowed_extensions] => Array
                      (
                          [0] => png
                          [1] => jpeg
                          [2] => jpg
                          [3] => gif
                          [4] => gtar
                          [5] => gz
                          [6] => tar
                          [7] => zip
                          [8] => rar
                          [9] => ace
                          [10] => txt
                          [11] => c
                          [12] => h
                          [13] => cpp
                          [14] => hpp
                          [15] => diz
                          [16] => xls
                          [17] => doc
                          [18] => dot
                          [19] => pdf
                          [20] => ai
                          [21] => ps
                          [22] => ppt
                          [23] => rm
                          [24] => 3gp
                          [25] => mpg
                          [26] => mp3
                          [27] => avi
                          [28] => wmv
                          [29] => wav
                          [30] => docx
                          [31] => xlsx
                          [32] => pptx
                      )
       
                  [disallowed_content] => Array
                      (
                          [0] => body
                          [1] => head
                          [2] => html
                          [3] => img
                          [4] => plaintext
                          [5] => a href
                          [6] => pre
                          [7] => script
                          [8] => table
                          [9] => title
                      )
       
                  [max_filesize] => 0
                  [min_width] => 0
                  [min_height] => 0
                  [max_width] => 0
                  [max_height] => 0
                  [error_prefix] => 
              )
       
      )
      

      $file->init_error is blank, but $file->error is filled with the correct error message.

        Issue Links

          Activity

          Hide
          bantu Andreas Fischer added a comment -

          Some cleanup / work in progress: https://github.com/bantu/phpbb3/compare/phpbb:develop-olympus...ticket/11145 I am not so sure $file->is_image() is all that reliable.

          Show
          bantu Andreas Fischer added a comment - Some cleanup / work in progress: https://github.com/bantu/phpbb3/compare/phpbb:develop-olympus...ticket/11145 I am not so sure $file->is_image() is all that reliable.

            People

            • Assignee:
              bantu Andreas Fischer
              Reporter:
              Derky Derky
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development