summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-09-21 15:38:26 +0100
committerGeorge Peter Banyard <girgias@php.net>2020-09-21 16:29:10 +0100
commitddd99a700563af06e8897901abf87e5da73009e6 (patch)
tree53e81c6ecf5b6730a23d81357c8d0114b6946ae9
parent2b6f5eec6c3d2b0596f7376ec41b316d1c4ac4e7 (diff)
downloadphp-git-ddd99a700563af06e8897901abf87e5da73009e6.tar.gz
Drop -1 mode for collator_is_numeric()
It is used only once with allow_errors enabled
-rw-r--r--ext/intl/collator/collator_convert.c4
-rw-r--r--ext/intl/collator/collator_is_numeric.c5
-rw-r--r--ext/intl/collator/collator_is_numeric.h2
3 files changed, 4 insertions, 7 deletions
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 <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