#11620 closed defect (bug) (fixed)
Upload Handling. Use is_numeric instead of ctype_digit.
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.9.1 | Priority: | high |
Severity: | normal | Version: | 2.9 |
Component: | Upload | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
The function ctype_digit() is used in wp_handle_upload() in /wp-admin/includes/file.php
Please, replace with is_numeric().
Attachments (1)
Change History (11)
#1
follow-up:
↓ 2
@
15 years ago
- Keywords has-patch added
- Milestone changed from Unassigned to 3.0
- Type changed from defect (bug) to enhancement
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
15 years ago
- Cc eval@… added
Replying to scribu:
Could you give a reason why you want this change to be made?
is_numeric() is a standard function for php version 4 and 5, while ctype_digit() is avaliable only in the "ctype" extension, which may have no support at all. In WordPress they refused ctype starting from the version 2.5.1, see for reference http://core.trac.wordpress.org/search?q=ctype_digit
And now if the "ctype" extension is missing on the server, a WP user can't upload media in wordPress through the administration panel. Perhaps you should add this enhancement to 2.9.1 or 2.9.2 milestone.
For those user, that already have the same problem, I propose use the following snippet in the template functions.php
if(!finction_exists('ctype_digit')) { function ctype_digit( $num ) { return is_numeric( $num ); } }
#3
in reply to:
↑ 2
@
15 years ago
Replying to markup:
Sorry. This one is correct.
if(!function_exists('ctype_digit')) { function ctype_digit( $num ) { return is_numeric( $num ); } }
#4
@
15 years ago
A very good reason, but I don't think it will make it in 2.9.1.
Knowing the percentage of WP users that don't have the ctype extension would help in determining the severity of the issue.
#6
@
15 years ago
- Milestone changed from 3.0 to 2.9.1
- Type changed from enhancement to defect (bug)
This should be 2.9.1, as this was introduced in 2.9 and therefore is a regression from 2.8.
Replying to markup:
if(!function_exists('ctype_digit'))
We would generally add those functions to compat.php. A plugin author could use it without knowing the ramifications, but at the same time, I don't think we currently account for any functions from extensions.
I grepped core and could not find another ctype_* function in use.
Could you give a reason why you want this change to be made?