Skip to content

Commit cb3833a

Browse files
author
William Felipe Welter
committed
Fixed bug #68638 pg_update() fails to store infinite values.
Regex to check float values changed to accept "infinity" values and ignore case. Quotes are added to prevent syntax error on PostgreSQL.
1 parent 7efbd70 commit cb3833a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/pgsql/pgsql.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5590,11 +5590,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
55905590
}
55915591
else {
55925592
/* FIXME: better regex must be used */
5593-
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) {
5593+
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) {
55945594
err = 1;
55955595
}
55965596
else {
55975597
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
5598+
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
55985599
}
55995600
}
56005601
break;

0 commit comments

Comments
 (0)