com php-src: Fixed bug #68638 pg_update() fails to store infinite values.: ext/pgsql/pgsql.c
| From: | Xinchen Hui | Date: | Wed, 04 Feb 2015 00:47:05 +0000 |
| Subject: | com php-src: Fixed bug #68638 pg_update() fails to store infinite values.: ext/pgsql/pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84885@lists.php.net to get a copy of this message | ||
Commit: cb3833a3bef1d40ff630f6a0af55648acaf664f7
Author: William Felipe Welter <william.welter@4linux.com.br> Tue, 3 Feb 2015
22:47:05 -0200
Parents: 7efbd70b034890df171cc0c48363f99121f0c19e
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cb3833a3bef1d40ff630f6a0af55648acaf664f7
Log:
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.
Bugs:
https://bugs.php.net/68638
Changed paths:
M ext/pgsql/pgsql.c
Diff:
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 16ce7bf..e8070ac 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -5590,11 +5590,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name,
con
}
else {
/* FIXME: better regex must be used */
- 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) {
+ 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) {
err = 1;
}
else {
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
+ php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
}
}
break;