File tree 1 file changed +35
-0
lines changed 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ pgsqlSetNoticeCallback catches Postgres "raise notice".
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('pdo ' ) || !extension_loaded ('pdo_pgsql ' )) die ('skip not loaded ' );
6
+ require_once dirname (__FILE__ ) . '/../../../ext/pdo/tests/pdo_test.inc ' ;
7
+ require_once dirname (__FILE__ ) . '/config.inc ' ;
8
+ PDOTest::skip ();
9
+ ?>
10
+ --FILE--
11
+ <?php
12
+ class Logger
13
+ {
14
+ public function disp ($ message ) { echo trim ($ message )."\n" ; }
15
+ public function dispRe ($ message ) { echo "Re " .trim ($ message )."\n" ; }
16
+ }
17
+ $ logger = new Logger ();
18
+ function attach ($ db , $ prefix = '' )
19
+ {
20
+ global $ logger ;
21
+ $ db ->pgsqlSetNoticeCallback (array ($ logger , 'disp ' .$ prefix ));
22
+ }
23
+ require dirname (__FILE__ ) . '/issue78621.inc ' ;
24
+ ?>
25
+ --EXPECT--
26
+ NOTICE: I tampered your data, did you know?
27
+ ReNOTICE: I tampered your data, did you know?
28
+ array(1) {
29
+ [0]=>
30
+ array(1) {
31
+ ["a"]=>
32
+ string(2) "oh"
33
+ }
34
+ }
35
+ Done
You can’t perform that action at this time.
0 commit comments