File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #72028 pg_query_params(): NULL converts to empty string
3
+ --SKIPIF--
4
+ <?php include ("skipif.inc " ); ?>
5
+ --FILE--
6
+ <?php
7
+ // create test table
8
+
9
+ include ('config.inc ' );
10
+
11
+ $ conn = pg_connect ($ conn_str );
12
+
13
+ $ table = "bug72028_ " . md5 (uniqid (time ()));
14
+
15
+ pg_query ("CREATE TABLE $ table (value TEXT, details TEXT); " );
16
+
17
+ $ sql = "INSERT INTO $ table (value, details) VALUES ($1, $2) " ;
18
+
19
+ $ params = array (null , "insert before looping with a reference " );
20
+ $ result = pg_query_params ($ conn , $ sql , $ params );
21
+
22
+ $ params2 = array (null , "insert after looping with a reference " );
23
+ foreach ($ params2 as &$ p ) {
24
+ // doing nothing
25
+ }
26
+ unset($ p );
27
+
28
+ $ result = pg_query_params ($ conn , $ sql , $ params2 );
29
+
30
+ $ r = pg_query ("SELECT * FROM $ table " );
31
+ while (false !== ($ i = pg_fetch_assoc ($ r ))) {
32
+ var_dump ($ i );
33
+ }
34
+
35
+ pg_query ("DROP TABLE $ table " );
36
+
37
+ ?>
38
+ ==DONE==
39
+ --EXPECT--
40
+ array(2) {
41
+ ["value"]=>
42
+ NULL
43
+ ["details"]=>
44
+ string(38) "insert before looping with a reference"
45
+ }
46
+ array(2) {
47
+ ["value"]=>
48
+ NULL
49
+ ["details"]=>
50
+ string(37) "insert after looping with a reference"
51
+ }
52
+ ==DONE==
You can’t perform that action at this time.
0 commit comments