__inet_pton() and inet_ntop() was named __inet_ntop(). (Hannes)
- Fixed the validate email filter so that the letter "v" can also be used in
the user part of the email address. (Derick)
+- Fixed bug #39971 (pg_insert/pg_update do not allow now() to be used for
+ timestamp fields). (Ilia)
- Fixed bug #39952 (zip ignoring --with-libdir on zlib checks) (judas dot
iscariote at gmail dot com)
- Fixed bug #39944 (References broken). (Dmitry)
switch(Z_TYPE_PP(val)) {
case IS_STRING:
if (Z_STRLEN_PP(val) == 0) {
- ZVAL_STRING(new_val, "NULL", 1);
- }
- else {
+ ZVAL_STRINGL(new_val, "NULL", sizeof("NULL")-1, 1);
+ } else if (!strcasecmp(Z_STRVAL_PP(val), "now()")) {
+ ZVAL_STRINGL(new_val, "NOW()", sizeof("NOW()")-1, 1);
+ } else {
/* FIXME: better regex must be used */
if (php_pgsql_convert_match(Z_STRVAL_PP(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
err = 1;
- }
- else {
+ } else {
ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1);
php_pgsql_add_quotes(new_val, 1 TSRMLS_CC);
}
break;
case IS_NULL:
- ZVAL_STRING(new_val, "NULL", 1);
+ ZVAL_STRINGL(new_val, "NULL", sizeof("NULL")-1, 1);
break;
default:
--- /dev/null
+--TEST--
+Bug #39971 (pg_insert/pg_update do not allow now() to be used for timestamp fields)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('config.inc');
+
+$dbh = @pg_connect($conn_str);
+if (!$dbh) {
+ die ("Could not connect to the server");
+}
+
+pg_query("CREATE TABLE php_test (id SERIAL, tm timestamp NOT NULL)");
+
+$values = array('tm' => 'now()');
+pg_insert($dbh, 'php_test', $values);
+
+$ids = array('id' => 1);
+pg_update($dbh, 'php_test', $values, $ids);
+
+pg_query($dbh, "DROP TABLE php_test");
+pg_close($dbh);
+?>
+===DONE===
+--EXPECT--
+===DONE===