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