80_bug36625.phpt 901 B

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