1--TEST-- 2PostgreSQL notice function 3--SKIPIF-- 4<?php 5 6include("skipif.inc"); 7 8_skip_lc_messages(); 9 10?> 11--INI-- 12--FILE-- 13<?php 14include 'config.inc'; 15include 'lcmess.inc'; 16 17ini_set('pgsql.log_notice', TRUE); 18ini_set('pgsql.ignore_notice', FALSE); 19 20$db = pg_connect($conn_str); 21 22_set_lc_messages(); 23 24$res = pg_query($db, 'SET client_min_messages TO NOTICE;'); 25var_dump($res); 26 27// Get empty notice 28var_dump(pg_last_notice($db)); 29var_dump(pg_last_notice($db, PGSQL_NOTICE_ALL)); 30 31pg_query($db, "BEGIN;"); 32pg_query($db, "BEGIN;"); 33pg_query($db, "BEGIN;"); 34pg_query($db, "BEGIN;"); 35 36// Get notices 37var_dump(pg_last_notice($db)); 38var_dump(pg_last_notice($db, PGSQL_NOTICE_ALL)); 39 40// Clear and get notices 41var_dump(pg_last_notice($db, PGSQL_NOTICE_CLEAR)); 42var_dump(pg_last_notice($db, PGSQL_NOTICE_LAST)); 43var_dump(pg_last_notice($db, PGSQL_NOTICE_ALL)); 44 45// Invalid option 46var_dump(pg_last_notice($db, 99)); 47?> 48--EXPECTF-- 49resource(%d) of type (pgsql result) 50string(0) "" 51array(0) { 52} 53 54Notice: pg_query(): %s already a transaction in progress in %s on line %d 55 56Notice: pg_query(): %s already a transaction in progress in %s on line %d 57 58Notice: pg_query(): %s already a transaction in progress in %s on line %d 59string(52) "WARNING: there is already a transaction in progress" 60array(3) { 61 [0]=> 62 string(52) "WARNING: there is already a transaction in progress" 63 [1]=> 64 string(52) "WARNING: there is already a transaction in progress" 65 [2]=> 66 string(52) "WARNING: there is already a transaction in progress" 67} 68bool(true) 69string(0) "" 70array(0) { 71} 72 73Warning: pg_last_notice(): Invalid option specified (99) in %s%e09notice.php on line %d 74bool(false) 75