xref: /PHP-7.2/ext/pgsql/tests/bug77047.phpt (revision 0434141c)
1--TEST--
2Bug #77047 pg_insert has a broken regex for the 'TIME WITHOUT TIMEZONE' data type
3--SKIPIF--
4<?php
5include("skipif.inc");
6?>
7--FILE--
8<?php
9error_reporting(E_ALL);
10
11include 'config.inc';
12
13$db = pg_connect($conn_str);
14
15pg_query($db, "DROP TABLE IF EXISTS bug77047");
16pg_query($db, "CREATE TABLE bug77047 (
17		t TIME WITHOUT TIME ZONE
18	)");
19
20pg_insert($db, "bug77047", array("t" => "13:31"));
21pg_insert($db, "bug77047", array("t" => "13:31:13"));
22pg_insert($db, "bug77047", array("t" => "1:2:3"));
23pg_insert($db, "bug77047", array("t" => "xyz"));
24pg_insert($db, "bug77047", array("t" => NULL));
25pg_insert($db, "bug77047", array("t" => ""));
26
27$res = pg_query($db, "SELECT t FROM bug77047");
28while (false !== ($row = pg_fetch_row($res))) {
29	var_dump(array_pop($row));
30}
31
32?>
33--EXPECTF--
34Notice: pg_insert(): Expects NULL or string for PostgreSQL time field (t) in %s on line %d
35string(8) "13:31:00"
36string(8) "13:31:13"
37string(8) "01:02:03"
38NULL
39NULL
40
41