File tree 2 files changed +35
-2
lines changed
2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -2151,12 +2151,12 @@ PHP_FUNCTION(pg_trace)
2151
2151
if (trace_mode > 0 ) {
2152
2152
#ifdef PQTRACE_REGRESS_MODE
2153
2153
if (trace_mode > (PQTRACE_SUPPRESS_TIMESTAMPS |PQTRACE_REGRESS_MODE )) {
2154
- zend_argument_value_error (2 , "must be PGSQL_TRACE_SUPPRESS_TIMESTAMPS and/or PGSQL_TRACE_REGRESS_MODE" );
2154
+ zend_argument_value_error (4 , "must be PGSQL_TRACE_SUPPRESS_TIMESTAMPS and/or PGSQL_TRACE_REGRESS_MODE" );
2155
2155
} else {
2156
2156
PQsetTraceFlags (pgsql , trace_mode );
2157
2157
}
2158
2158
#else
2159
- zend_argument_value_error (2 , "cannot set the trace mode as it's unsupported" );
2159
+ zend_argument_value_error (4 , "cannot set as trace is unsupported" );
2160
2160
#endif
2161
2161
}
2162
2162
RETURN_TRUE ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ pg_trace
3
+ --EXTENSIONS--
4
+ pgsql
5
+ --SKIPIF--
6
+ <?php include ("skipif.inc " ); ?>
7
+ --FILE--
8
+ <?php
9
+
10
+ include ('config.inc ' );
11
+
12
+ $ db = pg_connect ($ conn_str );
13
+ $ tracefile = __DIR__ . '/trace.tmp ' ;
14
+
15
+ try {
16
+ pg_trace ($ tracefile , 'w ' , $ db , 56432 );
17
+ } catch (ValueError $ e ) {
18
+ echo $ e ->getMessage () . PHP_EOL ;
19
+ }
20
+ var_dump (pg_trace ($ tracefile , 'w ' , $ db , 0 ));
21
+ $ res = pg_query ($ db , 'select 1 ' );
22
+ pg_untrace ($ db );
23
+
24
+ var_dump (gettype ($ rows ));
25
+ var_dump (count ($ rows ) > 0 );
26
+
27
+ ?>
28
+ --EXPECT--
29
+ pg_trace(): Argument #4 ($trace_mode) cannot set as trace is unsupported
30
+ bool(true)
31
+ string(5) "array"
32
+ bool(true)
33
+
You can’t perform that action at this time.
0 commit comments