1--TEST-- 2Bug #72028 pg_query_params(): NULL converts to empty string 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php include("inc/skipif.inc"); ?> 7--FILE-- 8<?php 9// create test table 10 11include('inc/config.inc'); 12 13$conn = pg_connect($conn_str); 14 15$table = "bug72028"; 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?> 37--CLEAN-- 38<?php 39require_once('inc/config.inc'); 40$table = "bug72028";; 41$conn = pg_connect($conn_str); 42 43pg_query($conn, "DROP TABLE IF EXISTS $table"); 44?> 45--EXPECT-- 46array(2) { 47 ["value"]=> 48 NULL 49 ["details"]=> 50 string(38) "insert before looping with a reference" 51} 52array(2) { 53 ["value"]=> 54 NULL 55 ["details"]=> 56 string(37) "insert after looping with a reference" 57} 58