]> granicus.if.org Git - php/commitdiff
Drop -1 mode for collator_is_numeric()
authorGeorge Peter Banyard <girgias@php.net>
Mon, 21 Sep 2020 14:38:26 +0000 (15:38 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Mon, 21 Sep 2020 15:29:10 +0000 (16:29 +0100)
It is used only once with allow_errors enabled

ext/intl/collator/collator_convert.c
ext/intl/collator/collator_is_numeric.c
ext/intl/collator/collator_is_numeric.h

index da2cb85673b5c036f18acd24ba6646a658f56b49..c9c49fcb3c7292c24b1232e30fdb1d8073dd866f 100644 (file)
@@ -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);
index 553b9d11edbcf21e293b6386652b6d4fa9a86d88..3fa9c0d13bc5cb2b6f787cf6310fda8dc343d751 100644 (file)
@@ -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) {
index 34b84e9990ba25692f62125701a96a7965cd6bed..e6b5b18658cd63917d547d0c0a9ae8b0717ed046 100644 (file)
@@ -19,6 +19,6 @@
 #include <php.h>
 #include <unicode/uchar.h>
 
-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