Skip to content

Commit 60d5cdf

Browse files
author
William Felipe Welter
committed
Fixed bug #68638 pg_update() fails to store infinite values
Check if value is "infinity" with strcasestr() to add quotes
1 parent bb3a81c commit 60d5cdf

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ext/pgsql/pgsql.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5591,15 +5591,13 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
55915591
else {
55925592
/* FIXME: better regex must be used */
55935593
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) {
5594-
err = 1;
5594+
err = 1;
55955595
}
55965596
else {
5597-
55985597
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
5599-
if(php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), "^([+-]{0,1}(inf)(inity){0,1})$", 1 TSRMLS_CC) == SUCCESS) {
5598+
if(strcasestr(Z_STRVAL_PP(val),"inf")!=0){
56005599
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
56015600
}
5602-
56035601
}
56045602
}
56055603
break;

0 commit comments

Comments
 (0)