From: George Peter Banyard Date: Mon, 21 Sep 2020 14:38:26 +0000 (+0100) Subject: Drop -1 mode for collator_is_numeric() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddd99a700563af06e8897901abf87e5da73009e6;p=php Drop -1 mode for collator_is_numeric() It is used only once with allow_errors enabled --- diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index da2cb85673..c9c49fcb3c 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -320,7 +320,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv ) */ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) { - int is_numeric = 0; + zend_uchar is_numeric = 0; zend_long lval = 0; double dval = 0; @@ -329,7 +329,7 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv ) COLLATOR_CONVERT_RETURN_FAILED( str ); } - if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) ) + if ( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, /* allow_errors */ 1 ) ) ) { if( is_numeric == IS_LONG ) { ZVAL_LONG(rv, lval); diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index 553b9d11ed..3fa9c0d13b 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -207,7 +207,7 @@ static zend_long collator_u_strtol(nptr, endptr, base) /* {{{ collator_is_numeric] * Taken from PHP6:is_numeric_unicode() */ -zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, int allow_errors ) +zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors ) { zend_long local_lval; double local_dval; @@ -252,9 +252,6 @@ zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, dou if (!allow_errors) { return 0; } - if (allow_errors == -1) { - zend_error(E_NOTICE, "A non well formed numeric value encountered"); - } if (allow_errors) { if (end_ptr_double > end_ptr_long && dval) { diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h index 34b84e9990..e6b5b18658 100644 --- a/ext/intl/collator/collator_is_numeric.h +++ b/ext/intl/collator/collator_is_numeric.h @@ -19,6 +19,6 @@ #include #include -zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, int allow_errors ); +zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors ); #endif // COLLATOR_IS_NUMERIC_H