summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index ea1a314395..e27bd22eca 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -5746,9 +5746,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, E_NOTICE, "'%s' does not match with '%s'", str, regex);
-#endif
ret = FAILURE;
}
else if (regerr) {
@@ -5987,7 +5984,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
else {
/* better regex? */
if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0) == FAILURE) {
- err = 1;
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[+-]{0,1}(inf)(inity){0,1}$", 1) == FAILURE) {
+ err = 1;
+ } else {
+ ZVAL_STRING(&new_val, Z_STRVAL_P(val));
+ php_pgsql_add_quotes(&new_val, 1);
+ }
}
else {
ZVAL_STRING(&new_val, Z_STRVAL_P(val));