Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#9625 closed defect (bug) (fixed)

Incorrect Upload Error Messages

Reported by: askapache's profile Askapache Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: Upload Keywords: has-patch commit
Focuses: Cc:

Description

Noticed that the $upload_error_strings are invalid, this patch has the correct error_strings based on the actual php source code /main/rfc1867.c and php.net

See Also: http://www.php.net/manual/en/features.file-upload.errors.php

Attachments (1)

file.php.diff (1.7 KB) - added by Askapache 17 years ago.
standards compliant (php4, php5, IETF) upload errors

Download all attachments as: .zip

Change History (15)

#1 @ryan
17 years ago

Not all defines are available in PHP 4.3, which we still support. That's why we don't use them. Looks like we're only missing "File upload stopped by extension."

#2 @Nicholas91
17 years ago

  • Cc dragos.nicholas@… added
  • Keywords commit added

#3 @ryan
17 years ago

  • Keywords needs-patch added; has-patch tested commit removed

#4 @Askapache
17 years ago

  • Keywords has-patch tested added; needs-patch removed

Good one ryan, I attached an updated patch that removes the use defined constants.. here's the differences in the rfc1867.c files for 5.2.9 vs 4.3.0

PHP 4.3.0

#define UPLOAD_ERROR_OK   0  /* File upload succesful */
#define UPLOAD_ERROR_A    1  /* Uploaded file exceeded upload_max_filesize */
#define UPLOAD_ERROR_B    2  /* Uploaded file exceeded MAX_FILE_SIZE */
#define UPLOAD_ERROR_C    3  /* Partially uploaded */
#define UPLOAD_ERROR_D    4  /* No file uploaded */

PHP 5.2.9

#define UPLOAD_ERROR_OK   0  /* File upload succesful */
#define UPLOAD_ERROR_A    1  /* Uploaded file exceeded upload_max_filesize */
#define UPLOAD_ERROR_B    2  /* Uploaded file exceeded MAX_FILE_SIZE */
#define UPLOAD_ERROR_C    3  /* Partially uploaded */
#define UPLOAD_ERROR_D    4  /* No file uploaded */
#define UPLOAD_ERROR_E    6  /* Missing /tmp or similar directory */
#define UPLOAD_ERROR_F    7  /* Failed to write file to disk */
#define UPLOAD_ERROR_X    8  /* File upload stopped by extension */

#5 @Askapache
17 years ago

  • Cc webmaster@… added
  • Owner set to Askapache
  • Status changed from new to assigned

#6 @Askapache
17 years ago

  • Owner Askapache deleted
  • Status changed from assigned to new

#7 @Denis-de-Bernardy
17 years ago

  • Keywords changed from has-patch,tested to has-patch tested

#8 @ryan
17 years ago

The empty string in the array is needed to keep the numbers in sync. Note that the error codes skip from 4 to 6.

#9 @Denis-de-Bernardy
17 years ago

  • Keywords needs-patch added; has-patch tested removed

#10 @janeforshort
17 years ago

  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

#11 @Askapache
17 years ago

  • Keywords has-patch added; needs-patch removed

Ok here's the diff.

@Askapache
17 years ago

standards compliant (php4, php5, IETF) upload errors

#12 @Denis-de-Bernardy
17 years ago

  • Milestone changed from Future Release to 2.8

#13 @Denis-de-Bernardy
17 years ago

  • Keywords commit added

any interest?

#14 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11304]) Update upload error strings. Props Askapache. fixes #9625

Note: See TracTickets for help on using tickets.