1--TEST-- 2Bug #32223 (weird behaviour of pg_last_notice) 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php 7require_once('skipif.inc'); 8 9_skip_lc_messages($conn); 10 11@pg_query($conn, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'"); 12$res = @pg_query($conn, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS ' 13begin 14 RAISE NOTICE ''11111''; 15 return ''f''; 16end; 17' LANGUAGE plpgsql;"); 18if (!$res) die('skip PLPGSQL not available'); 19?> 20--INI-- 21pgsql.ignore_notice=0 22--FILE-- 23<?php 24 25require_once('config.inc'); 26require_once('lcmess.inc'); 27 28$dbh = @pg_connect($conn_str); 29if (!$dbh) { 30 die ("Could not connect to the server"); 31} 32 33_set_lc_messages($dbh); 34 35$res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS ' 36begin 37 RAISE NOTICE ''11111''; 38 return ''f''; 39end; 40' LANGUAGE plpgsql;"); 41 42$res = pg_query($dbh, 'SET client_min_messages TO NOTICE;'); 43var_dump($res); 44$res = pg_query($dbh, 'SELECT test_notice()'); 45var_dump($res); 46$row = pg_fetch_row($res, 0); 47var_dump($row); 48pg_free_result($res); 49if ($row[0] == 'f') 50{ 51 var_dump(pg_last_notice($dbh)); 52} 53 54pg_close($dbh); 55 56?> 57--EXPECTF-- 58object(PgSql\Result)#%d (0) { 59} 60object(PgSql\Result)#%d (0) { 61} 62array(1) { 63 [0]=> 64 string(1) "f" 65} 66string(14) "NOTICE: 11111" 67