Skip to content

Commit ddd99a7

Browse files
committed
Drop -1 mode for collator_is_numeric()
It is used only once with allow_errors enabled
1 parent 2b6f5ee commit ddd99a7

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

ext/intl/collator/collator_convert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ zval* collator_convert_string_to_double( zval* str, zval *rv )
320320
*/
321321
zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv )
322322
{
323-
int is_numeric = 0;
323+
zend_uchar is_numeric = 0;
324324
zend_long lval = 0;
325325
double dval = 0;
326326

@@ -329,7 +329,7 @@ zval* collator_convert_string_to_number_if_possible( zval* str, zval *rv )
329329
COLLATOR_CONVERT_RETURN_FAILED( str );
330330
}
331331

332-
if( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, 1 ) ) )
332+
if ( ( is_numeric = collator_is_numeric( (UChar*) Z_STRVAL_P(str), UCHARS( Z_STRLEN_P(str) ), &lval, &dval, /* allow_errors */ 1 ) ) )
333333
{
334334
if( is_numeric == IS_LONG ) {
335335
ZVAL_LONG(rv, lval);

ext/intl/collator/collator_is_numeric.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static zend_long collator_u_strtol(nptr, endptr, base)
207207
/* {{{ collator_is_numeric]
208208
* Taken from PHP6:is_numeric_unicode()
209209
*/
210-
zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, int allow_errors )
210+
zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors )
211211
{
212212
zend_long local_lval;
213213
double local_dval;
@@ -252,9 +252,6 @@ zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, dou
252252
if (!allow_errors) {
253253
return 0;
254254
}
255-
if (allow_errors == -1) {
256-
zend_error(E_NOTICE, "A non well formed numeric value encountered");
257-
}
258255

259256
if (allow_errors) {
260257
if (end_ptr_double > end_ptr_long && dval) {

ext/intl/collator/collator_is_numeric.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
#include <php.h>
2020
#include <unicode/uchar.h>
2121

22-
zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, int allow_errors );
22+
zend_uchar collator_is_numeric( UChar *str, int32_t length, zend_long *lval, double *dval, bool allow_errors );
2323

2424
#endif // COLLATOR_IS_NUMERIC_H

0 commit comments

Comments
 (0)