#32223 [Asn->Csd]: weird behaviour of pg_last_notice
| From: | helly@php.net | Date: | Mon, 07 Nov 2005 13:02:19 +0000 |
| Subject: | #32223 [Asn->Csd]: weird behaviour of pg_last_notice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-87753@lists.php.net to get a copy of this message | ||
ID: 32223
Updated by: helly@php.net
Reported By: valiak at gmail dot com
-Status: Assigned
+Status: Closed
Bug Type: PostgreSQL related
Operating System: *
PHP Version: 5CVS-2005-10-10
Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in 4.4.2-dev, 5.1.0RC4-dev, HEAD
Previous Comments:
------------------------------------------------------------------------
[2005-11-07 13:58:45] helly@php.net
The extension code used an unnecessary indirection which was only a
problem in your case.
------------------------------------------------------------------------
[2005-10-10 12:25:35] sniper@php.net
Marcus?
------------------------------------------------------------------------
[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 ''11111'';
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 ''11111'';
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: 11111"
===DONE===
------------------------------------------------------------------------
[2005-10-09 18:07:55] helly@php.net
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] sniper@php.net
Assigned to the maintainer.
------------------------------------------------------------------------
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=32223&edit=1