@@ -2664,7 +2664,7 @@ ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_long *l
26642664ZEND_API zend_uchar _is_numeric_string_ex (const char * str , size_t length , zend_long * lval , double * dval , int allow_errors , int * oflow_info ) /* {{{ */
26652665{
26662666 const char * ptr ;
2667- int base = 10 , digits = 0 , dp_or_e = 0 ;
2667+ int digits = 0 , dp_or_e = 0 ;
26682668 double local_dval = 0.0 ;
26692669 zend_uchar type ;
26702670
@@ -2689,13 +2689,6 @@ ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_l
26892689 }
26902690
26912691 if (ZEND_IS_DIGIT (* ptr )) {
2692- /* Handle hex numbers
2693- * str is used instead of ptr to disallow signs and keep old behavior */
2694- if (length > 2 && * str == '0' && (str [1 ] == 'x' || str [1 ] == 'X' )) {
2695- base = 16 ;
2696- ptr += 2 ;
2697- }
2698-
26992692 /* Skip any leading 0s */
27002693 while (* ptr == '0' ) {
27012694 ptr ++ ;
@@ -2706,42 +2699,30 @@ ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_l
27062699 * a full match, stop when there are too many digits for a long */
27072700 for (type = IS_LONG ; !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1 )); digits ++ , ptr ++ ) {
27082701check_digits :
2709- if (ZEND_IS_DIGIT (* ptr ) || ( base == 16 && ZEND_IS_XDIGIT ( * ptr )) ) {
2702+ if (ZEND_IS_DIGIT (* ptr )) {
27102703 continue ;
2711- } else if (base == 10 ) {
2712- if (* ptr == '.' && dp_or_e < 1 ) {
2713- goto process_double ;
2714- } else if ((* ptr == 'e' || * ptr == 'E' ) && dp_or_e < 2 ) {
2715- const char * e = ptr + 1 ;
2704+ } else if (* ptr == '.' && dp_or_e < 1 ) {
2705+ goto process_double ;
2706+ } else if ((* ptr == 'e' || * ptr == 'E' ) && dp_or_e < 2 ) {
2707+ const char * e = ptr + 1 ;
27162708
2717- if (* e == '-' || * e == '+' ) {
2718- ptr = e ++ ;
2719- }
2720- if (ZEND_IS_DIGIT (* e )) {
2721- goto process_double ;
2722- }
2709+ if (* e == '-' || * e == '+' ) {
2710+ ptr = e ++ ;
2711+ }
2712+ if (ZEND_IS_DIGIT (* e )) {
2713+ goto process_double ;
27232714 }
27242715 }
27252716
27262717 break ;
27272718 }
27282719
2729- if (base == 10 ) {
2730- if (digits >= MAX_LENGTH_OF_LONG ) {
2731- if (oflow_info != NULL ) {
2732- * oflow_info = * str == '-' ? -1 : 1 ;
2733- }
2734- dp_or_e = -1 ;
2735- goto process_double ;
2736- }
2737- } else if (!(digits < SIZEOF_ZEND_LONG * 2 || (digits == SIZEOF_ZEND_LONG * 2 && ptr [- digits ] <= '7' ))) {
2738- if (dval ) {
2739- local_dval = zend_hex_strtod (str , & ptr );
2740- }
2720+ if (digits >= MAX_LENGTH_OF_LONG ) {
27412721 if (oflow_info != NULL ) {
2742- * oflow_info = 1 ;
2722+ * oflow_info = * str == '-' ? -1 : 1 ;
27432723 }
2744- type = IS_DOUBLE ;
2724+ dp_or_e = -1 ;
2725+ goto process_double ;
27452726 }
27462727 } else if (* ptr == '.' && ZEND_IS_DIGIT (ptr [1 ])) {
27472728process_double :
@@ -2785,7 +2766,7 @@ ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_l
27852766 }
27862767
27872768 if (lval ) {
2788- * lval = ZEND_STRTOL (str , NULL , base );
2769+ * lval = ZEND_STRTOL (str , NULL , 10 );
27892770 }
27902771
27912772 return IS_LONG ;
0 commit comments