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