com php-src: Fixed bug #68638 pg_update() fails to store infinite values. Add quotes only if "in finity" values are received.: ext/pgsql/pgsql.c
| From: | Xinchen Hui | Date: | Sat, 07 Feb 2015 03:26:12 +0000 |
| Subject: | com php-src: Fixed bug #68638 pg_update() fails to store infinite values. Add quotes only if "in finity" values are received.: ext/pgsql/pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84880@lists.php.net to get a copy of this message | ||
Commit: bb3a81c4b482e94354fed40d0f1e1f81afca7437
Author: William Felipe Welter <william.welter@4linux.com.br> Sat, 7 Feb 2015
01:26:12 -0200
Parents: b64f1491768426cd9602dc7057a220ef5b5e4cfd
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bb3a81c4b482e94354fed40d0f1e1f81afca7437
Log:
Fixed bug #68638 pg_update() fails to store infinite values.
Add quotes only if "infinity" values are received.
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 e8070ac..f4595c7 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -5590,12 +5590,16 @@ 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,1}(INF)(inity){0,1})$",
1 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);
+ if(php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val),
"^([+-]{0,1}(inf)(inity){0,1})$", 1 TSRMLS_CC) == SUCCESS) {
+ php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
+ }
+
}
}
break;