bug77047.phpt 988 B

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