@@ -5357,9 +5357,6 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char *
5357
5357
5358
5358
regerr = regexec (& re , str , re .re_nsub + 1 , subs , 0 );
5359
5359
if (regerr == REG_NOMATCH ) {
5360
- #ifdef PHP_DEBUG
5361
- php_error_docref (NULL TSRMLS_CC , E_NOTICE , "'%s' does not match with '%s'" , str , regex );
5362
- #endif
5363
5360
ret = FAILURE ;
5364
5361
}
5365
5362
else if (regerr ) {
@@ -5607,14 +5604,16 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
5607
5604
}
5608
5605
else {
5609
5606
/* FIXME: better regex must be used */
5610
- if (php_pgsql_convert_match (Z_STRVAL_PP (val ), Z_STRLEN_PP (val ), "^([+-]{0,1}[0-9]+)|([+-]{0,1}[0-9]*[\\.][0-9]+)|([+-]{0,1}[0-9]+[\\.][0-9]*)|([+-]{0,1}(inf)(inity){0,1})$" , 1 TSRMLS_CC ) == FAILURE ) {
5611
- err = 1 ;
5607
+ if (php_pgsql_convert_match (Z_STRVAL_PP (val ), Z_STRLEN_PP (val ), "^([+-]{0,1}[0-9]+)|([+-]{0,1}[0-9]*[\\.][0-9]+)|([+-]{0,1}[0-9]+[\\.][0-9]*)$" , 0 TSRMLS_CC ) == FAILURE ) {
5608
+ if (php_pgsql_convert_match (Z_STRVAL_PP (val ), Z_STRLEN_PP (val ), "^[+-]{0,1}(inf)(inity){0,1}$" , 1 TSRMLS_CC ) == FAILURE ) {
5609
+ err = 1 ;
5610
+ } else {
5611
+ ZVAL_STRING (new_val , Z_STRVAL_PP (val ), 1 );
5612
+ php_pgsql_add_quotes (new_val , 1 TSRMLS_CC );
5613
+ }
5612
5614
}
5613
5615
else {
5614
5616
ZVAL_STRING (new_val , Z_STRVAL_PP (val ), 1 );
5615
- if (strcasestr (Z_STRVAL_PP (val ),"inf" )!= 0 ){
5616
- php_pgsql_add_quotes (new_val , 1 TSRMLS_CC );
5617
- }
5618
5617
}
5619
5618
}
5620
5619
break ;
0 commit comments