com php-src: Fixed bug #68638 (pg_update() fails to store infinite values): NEWS ext/pgsql/pgsql.c
| From: | Xinchen Hui | Date: | Sat, 14 Feb 2015 14:17:01 +0000 |
| Subject: | com php-src: Fixed bug #68638 (pg_update() fails to store infinite values): NEWS ext/pgsql/pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84884@lists.php.net to get a copy of this message | ||
Commit: 7667f8efc6ee9727cbd7af26e5f62f9cebd8a25e
Author: Xinchen Hui <laruence@php.net> Sat, 14 Feb 2015 22:14:31 +0800
Parents: 40a94597aeef59172cefecb25c79ec54ff7b5725
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7667f8efc6ee9727cbd7af26e5f62f9cebd8a25e
Log:
Fixed bug #68638 (pg_update() fails to store infinite values)
Bugs:
https://bugs.php.net/68638
Changed paths:
M NEWS
M ext/pgsql/pgsql.c
Diff:
diff --git a/NEWS b/NEWS
index 30302e6..a0ffd3e 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ PHP NEWS
. Fix bug #61285, #68329, #68046, #41631: encrypted streams don't observe
socket timeouts (Brad Broerman)
+- pgsql:
+ . Fixed bug #68638 (pg_update() fails to store infinite values).
+ (william dot welter at 4linux dot com dot br, Laruence)
+
- CGI:
. Fixed bug #69015 (php-cgi's getopt does not see $argv). (Laruence)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 68459f1..2f12fd1 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -5357,9 +5357,6 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char
*
regerr = regexec(&re, str, re.re_nsub+1, subs, 0);
if (regerr == REG_NOMATCH) {
-#ifdef PHP_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "'%s' does not match with
'%s'", str, regex);
-#endif
ret = FAILURE;
}
else if (regerr) {
@@ -5607,14 +5604,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) {
- err = 1;
+ 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}(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);
+ }
}
else {
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
- if(strcasestr(Z_STRVAL_PP(val),"inf")!=0){
- php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
- }
}
}
break;