Closed (fixed)
Project:
Drupal core
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Feb 2004 at 12:55 UTC
Updated:
12 Mar 2004 at 12:20 UTC
Jump to comment: Most recent file
file.inc uses constants that only exist in PHP 4.3 or higher (http://nl.php.net/manual/en/features.file-upload.errors.php) causing file uploads to fail in PHP 4.2.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | file-constants2.patch | 853 bytes | bart jansens |
| 20040215.file-constants.patch | 629 bytes | bart jansens |
Comments
Comment #1
dries commentedCommitted to HEAD. Thanks.
Comment #2
gábor hojtsyThis should be wrapped in an if (defined('UPLOAD_ERR_OK')) IMHO, since after this patch, the code will not work with PHP 4.3+ :)
Comment #3
bart jansens commentedUnfortunatly i'm not seeing the notices but the attached patch should fix this :)
Comment #4
ax commentedtested and working (no more notices). please apply.
Comment #5
magico commentedI think that is better to check for PHP version instead of checking for one constant definition.
// Required for file uploads to work with PHP 4.2
if (version_compare(phpversion(), '4.2.0', '<='))
{
define('UPLOAD_ERR_OK', 0);
define('UPLOAD_ERR_INI_SIZE', 1);
define('UPLOAD_ERR_FORM_SIZE', 2);
define('UPLOAD_ERR_PARTIAL', 3);
define('UPLOAD_ERR_NO_FILE', 4);
}
Comment #6
(not verified) commentedNope. Since we define the constants, they only need to be defined, if they are not defined yet. You do the same with functions...
Checking for PHP version is odd... Only the constants are the problem as the reported indicated. Please apply Bart's patch.
Comment #7
(not verified) commentedComment #8
Kjartan commentedThis should be fixed in CVS:
Comment #9
(not verified) commented