ID: 32223
Updated by: [EMAIL PROTECTED]
Reported By: valiak at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: PostgreSQL related
Operating System: *
PHP Version: 5CVS-2005-10-10
Assigned To: helly
New Comment:
Marcus?
Previous Comments:
[2005-10-10 12:24:06] valiak at gmail dot com
i tried with the new version problem still exists (it does not exists
in version 4)
your script differs from the one I have posted, the main difference is
that I use constant to store the return value of pg_connect, the code
is in funcion, and the include must appear bellow pg_connect, try this
test:
--TEST--
Bug #32223 (weird behaviour of pg_last_notice)
--SKIPIF--
?php
require_once('skipif.inc');
@pg_query($conn, CREATE LANGUAGE 'plpgsql' HANDLER
plpgsql_call_handler LANCOMPILER 'PL/pgSQL');
$res = @pg_query($conn, CREATE OR REPLACE FUNCTION test_notice()
RETURNS boolean AS '
begin
RAISE NOTICE ''1'';
return ''f'';
end;
' LANGUAGE plpgsql;);
if (!$res) die('skip PLPGSQL not available');
?
--FILE--
?php
require('config.inc');
define ('dbh', pg_connect($conn_str));
require('config.inc');
if (!dbh) {
die (Could not connect to the server);
}
//@pg_query(dbh, CREATE LANGUAGE 'plpgsql' HANDLER
plpgsql_call_handler LANCOMPILER 'PL/pgSQL');
$res = pg_query(dbh, CREATE OR REPLACE FUNCTION test_notice() RETURNS
boolean AS '
begin
RAISE NOTICE ''1'';
return ''f'';
end;
' LANGUAGE plpgsql;);
function tester() {
$res = pg_query(dbh, 'SELECT test_notice()');
$row = pg_fetch_row($res, 0);
var_dump($row);
pg_free_result($res);
if ($row[0] == 'f')
{
var_dump(pg_last_notice(dbh));
}
}
tester();
pg_close(dbh);
?
===DONE===
--EXPECTF--
array(1) {
[0]=
string(1) f
}
string(14) NOTICE: 1
===DONE===
[2005-10-09 18:07:55] [EMAIL PROTECTED]
I made up a php test script for this: ext/pgsql/tests/80_bug32223.phpt
But i cannot reproduce your behavior with 5.1-dev or HEAD.
Maybe it is postgres?
marcus=# select version();
version
--
PostgreSQL 8.0.1 on i586-mandrake-linux-gnu, compiled by GCC
i586-mandrake-linux-gnu-gcc (GCC) 3.4.3 (Mandrakelinux 10.2
3.4.3-7mdk)
Works in all versions for me. So please try the following:
php run-tests.php ext/pgsql/tests/80_bug32223.phpt
If that fails, can you do a 'memcheck' on that?
And tell me your postgres version.
[2005-09-24 20:36:28] [EMAIL PROTECTED]
Assigned to the maintainer.
[2005-09-23 15:55:35] valiak at gmail dot com
the code snipped is presented in the bug report and is
quite easily reproduced on any machine with postgresql and
php5 I have tried, there were some other users confirming
the problem, but are deleted from the bug report.
It has external resources such as databases, etc.
because it is a database related bug!!
I use Short tags because it is written here
http://www.php.net/manual/en/language.basic-syntax.php
that I can use them.
Anyway . here is even more short version of the
bug
(but still with external resources!!! and two files)
http://ce.noxis.net/pg_last_notice/test.php // the main
file
http://ce.noxis.net/pg_last_notice/test.inc.php // the
include
http://ce.noxis.net/pg_last_notice/db.sql // the database
schema - only one function
[2005-09-02 14:48:49] valiak at gmail dot com
still do not work correctly, there is no output even with
E_ALL
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/32223
--
Edit this bug report at http://bugs.php.net/?id=32223edit=1