80_bug36625.phpt 940 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Bug #36625 (8.0+) (pg_trace() does not work)
  3. --EXTENSIONS--
  4. pgsql
  5. --SKIPIF--
  6. <?php
  7. require_once('skipif.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once('config.inc');
  12. $dbh = @pg_connect($conn_str);
  13. if (!$dbh) {
  14. die ('Could not connect to the server');
  15. }
  16. $tracefile = __DIR__ . '/trace.tmp';
  17. @unlink($tracefile);
  18. var_dump(file_exists($tracefile));
  19. pg_trace($tracefile, 'w', $dbh);
  20. $res = pg_query($dbh, 'select 1');
  21. var_dump($res);
  22. pg_close($dbh);
  23. $found = 0;
  24. function search_trace_file($line)
  25. {
  26. if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) {
  27. $GLOBALS['found']++;
  28. }
  29. }
  30. $trace = file($tracefile);
  31. array_walk($trace, 'search_trace_file');
  32. var_dump($found > 0);
  33. var_dump(file_exists($tracefile));
  34. @unlink($tracefile);
  35. ?>
  36. --CLEAN--
  37. <?php
  38. $tracefile = __DIR__ . '/trace.tmp';
  39. unlink($tracefile);
  40. ?>
  41. --EXPECTF--
  42. bool(false)
  43. object(PgSql\Result)#%d (0) {
  44. }
  45. bool(true)
  46. bool(true)