Skip to content

Commit

Permalink
Merge pull request #262 from develart-projects/isNumber-bugfix
Browse files Browse the repository at this point in the history
isNumber() bugfix
  • Loading branch information
develart-projects committed Aug 9, 2023
2 parents 7fa9c5f + d7f99e7 commit 4afdf79
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion library/Zend/Locale/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ public static function isNumber($input, array $options = [])
if (!self::_getUniCodeSupport()) {
trigger_error("Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core", E_USER_NOTICE);
}

if($input === null ) {
return FALSE;
}

$options = self::_checkOptions($options) + self::$_options;

Expand All @@ -524,7 +528,10 @@ public static function isNumber($input, array $options = [])

$regexs = Zend_Locale_Format::_getRegexForType('decimalnumber', $options);
$regexs = array_merge($regexs, Zend_Locale_Format::_getRegexForType('scientificnumber', $options));
if (!empty($input) && ($input[0] == $symbols['decimal'])) {

$firstChar = substr($input,0,1);

if (!empty($input) && ($firstChar == $symbols['decimal'])) {
$input = 0 . $input;
}
foreach ($regexs as $regex) {
Expand Down

0 comments on commit 4afdf79

Please sign in to comment.