per wegges suggestion because:
1. $in can't be a floating point number
2. When typecast php ignores any non-integers after the first row of integers
3. A regular expression would be slower and insanely complex
* Insert kind comments about php and remarks about how much I appriciate its existance here*
*/
function isByte( $in ) {
$fname = 'isByte';
- if ( is_numeric( $in ) && $in >= 0 && $in <= 255 ) {
+ if ( sprintf('%d', $in) === $in && $in >= 0 && $in <= 255 ) {
wfDebug("Exif::$fname: accepted: '$in' (type: " . gettype( $in ) . ")\n");
return true;
} else {
function isShort( $in ) {
$fname = 'isShort';
- if ( is_numeric( $in ) && $in >= 0 && $in <= 65536 ) {
+ if ( sprintf('%d', $in) === $in && $in >= 0 && $in <= 65536 ) {
wfDebug("Exif::$fname: accepted: '$in' (type: " . gettype( $in ) . ")\n");
return true;
} else {
function isLong( $in ) {
$fname = 'isLong';
- if ( is_numeric( $in ) && $in >= 0 && $in <= 4294967296 ) {
+ if ( sprintf('%d', $in) === $in && $in >= 0 && $in <= 4294967296 ) {
wfDebug("Exif::$fname: accepted: '$in' (type: " . gettype( $in ) . ")\n");
return true;
} else {