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

Use IMAGETYPE_ constants in get_supported_image_types()

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0-a1
    • Component/s: Other
    • Labels:
      None

      Description

      Currently includes/functions_posting.php contains the IMAGETYPE_ constant values written as magic numbers, this should be changed to use the constants. See: #25925.

      Same applies to fileupload::image_types() in includes/functions_upload.php.

        Activity

        Hide
        bantu Andreas Fischer added a comment -

        bam!

        Show
        bantu Andreas Fischer added a comment - bam!
        Hide
        ToonArmy Chris Smith added a comment -

        These constants are available even if gd is disabled.

        Show
        ToonArmy Chris Smith added a comment - These constants are available even if gd is disabled.
        Hide
        ToonArmy Chris Smith added a comment - - edited

        For reference:

        php -r '$c = array(); foreach(get_defined_constants() as $name => $value) if (strpos($name, 'IMAGETYPE') === 0) $c[$name] = $value; asort($c); foreach ($c as $name => $value) echo "$name = $value\n";'

        IMAGETYPE_GIF = 1
        IMAGETYPE_JPEG = 2
        IMAGETYPE_PNG = 3
        IMAGETYPE_SWF = 4
        IMAGETYPE_PSD = 5
        IMAGETYPE_BMP = 6
        IMAGETYPE_TIFF_II = 7
        IMAGETYPE_TIFF_MM = 8
        IMAGETYPE_JPEG2000 = 9
        IMAGETYPE_JPC = 9
        IMAGETYPE_JP2 = 10
        IMAGETYPE_JPX = 11
        IMAGETYPE_JB2 = 12
        IMAGETYPE_SWC = 13
        IMAGETYPE_IFF = 14
        IMAGETYPE_WBMP = 15
        IMAGETYPE_XBM = 16

        Show
        ToonArmy Chris Smith added a comment - - edited For reference: php -r '$c = array(); foreach(get_defined_constants() as $name => $value) if (strpos($name, 'IMAGETYPE') === 0) $c[$name] = $value; asort($c); foreach ($c as $name => $value) echo "$name = $value\n";' IMAGETYPE_GIF = 1 IMAGETYPE_JPEG = 2 IMAGETYPE_PNG = 3 IMAGETYPE_SWF = 4 IMAGETYPE_PSD = 5 IMAGETYPE_BMP = 6 IMAGETYPE_TIFF_II = 7 IMAGETYPE_TIFF_MM = 8 IMAGETYPE_JPEG2000 = 9 IMAGETYPE_JPC = 9 IMAGETYPE_JP2 = 10 IMAGETYPE_JPX = 11 IMAGETYPE_JB2 = 12 IMAGETYPE_SWC = 13 IMAGETYPE_IFF = 14 IMAGETYPE_WBMP = 15 IMAGETYPE_XBM = 16
        Hide
        bantu Andreas Fischer added a comment -

        I'd suggest to align the array keys and values to "=>".

        Show
        bantu Andreas Fischer added a comment - I'd suggest to align the array keys and values to "=>".
        Hide
        igorw Igor Wiedler [X] (Inactive) added a comment -

        There's still a bad comment in functions_posting:

            // We do not use the constants here, because some were not available in PHP 4.3.x
        

        Needs to be removed.

        Show
        igorw Igor Wiedler [X] (Inactive) added a comment - There's still a bad comment in functions_posting: // We do not use the constants here, because some were not available in PHP 4.3.x Needs to be removed.

          People

          • Assignee:
            Oleg Oleg [X] (Inactive)
            Reporter:
            ToonArmy Chris Smith
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development