pg_insert_002.phpt 652 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. PostgreSQL pg_insert() - test for CVE-2015-1532
  3. --EXTENSIONS--
  4. pgsql
  5. --SKIPIF--
  6. <?php include("skipif.inc"); ?>
  7. --FILE--
  8. <?php
  9. include('config.inc');
  10. $conn = pg_connect($conn_str);
  11. foreach (array('', '.', '..') as $table) {
  12. try {
  13. var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1)));
  14. } catch (\ValueError $e) {
  15. echo $e->getMessage() . \PHP_EOL;
  16. }
  17. }
  18. ?>
  19. Done
  20. --EXPECTF--
  21. pg_insert(): Argument #2 ($table_name) cannot be empty
  22. Warning: pg_insert(): The table name must be specified in %s on line %d
  23. bool(false)
  24. Warning: pg_insert(): The table name must be specified in %s on line %d
  25. bool(false)
  26. Done