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