Zend Framework

Validation against file extensions in Zend_Validate_File_Extension fails if the filename contains a Dot "."

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.6.0
  • Fix Version/s: 1.6.2
  • Component/s: Zend_Validate_File
  • Labels:
    None

Description

Validation against file extensions in Zend_Validate_File_Extension fails if the filename contains a Dot "."
More specific: In function isValid of Class Zend_Validate_File_Extension in line 166 the substring operation is set on the FIRST occurance of "." and not on the last. If the filename is filename.1.jpg a file extension "1.jpg" is defined for checking against allowed extensions. This will fail.
Changing line 166 for

$info['extension'] = substr($file['name'], strpos($file['name'], '.') + 1);

to

$info['extension'] = substr($file['name'], strrpos($file['name'], '.') + 1);

Solves the problem.

Best Regards

Activity

Hide
Thomas Weidner added a comment -

Fixed with r11432

Show
Thomas Weidner added a comment - Fixed with r11432

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
10m
Time Spent - 10 minutes