#32223 [Fbk->Opn]: weird behaviour of pg_last_notice
| From: | valiak at gmail dot com | Date: | Fri, 23 Sep 2005 13:55:36 +0000 |
| Subject: | #32223 [Fbk->Opn]: weird behaviour of pg_last_notice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85502@lists.php.net to get a copy of this message | ||
ID: 32223
User updated by: valiak at gmail dot com
Reported By: valiak at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: PostgreSQL related
Operating System: *
PHP Version: 5CVS-2005-09-02
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2005-09-21 12:24:39] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2005-09-02 14:48:49] valiak at gmail dot com
still do not work correctly, there is no output even with
E_ALL
------------------------------------------------------------------------
[2005-08-30 13:05:52] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
And set error_reporting to E_ALL..
------------------------------------------------------------------------
[2005-03-08 13:28:02] valiak at gmail dot com
if you switch the places of include_once and define there is no bug
there is no difference in the behaviour if include_once is changed to
include or require_once or require
------------------------------------------------------------------------
[2005-03-07 18:13:54] valiak at gmail dot com
Description:
------------
i've tried to localize to as smallest code as I could
the correct result happens even if you comment the include line or the
global directive or not using exceptions ... (there are few other
modifications too)
it happens with the cli version and with the apache module version
ceco@base ~/tmp/pg_last_notice
$ php -v
PHP 5.0.3 (cli) (built: Mar 2 2005 13:13:40)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
compiled with
./configure --with-gettext --with-oci8 --with-apxs=/usr/bin/apxs
--with-gd --with-pgsql --with-readline --with-zlib --with-mysql=/usr
--with-
jpeg-dir --with-png-dir --enable-mbstring --enable-sockets
--enable-pcntl --enable-sigchild --with-exec-dir=/usr/bin
--with-config-file-path=
/etc/php5
pgsql
PostgreSQL Support => enabled
PostgreSQL(libpq) Version => 8.0.1
Multibyte character support => enabled
SSL support => disabled
Active Persistent Links => 0
Active Links => 0
Directive => Local Value => Master Value
pgsql.allow_persistent => Off => Off
pgsql.auto_reset_persistent => Off => Off
pgsql.ignore_notice => Off => Off
pgsql.log_notice => Off => Off
pgsql.max_links => Unlimited => Unlimited
pgsql.max_persistent => Unlimited => Unlimited
if some more info is needed tell me what to do?
Reproduce code:
---------------
ceco@base ~/tmp/pg_last_notice
$ cat test.inc.php
<?
?>
ceco@base ~/tmp/pg_last_notice
$ cat test.php
<?
/*
this is a dummy pg function just to raise notice, called from this
file
CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS $$
begin
RAISE NOTICE '11111';
return 'f';
end;
$$ LANGUAGE plpgsql;
*/
define(TTT, pg_connect('user=test password=test
dbname=test'));
include_once 'test.inc.php';
function tester() {
global $t;
$res = pg_query(TTT, 'SELECT test_notice()');
$result = pg_fetch_row($res, 0);
pg_free_result($res);
if ($result[0] == 'f') {
throw new Exception(pg_last_notice(TTT));
}
}
try {
echo tester();
echo 2;
}
catch (Exception $e) {
echo $e->getMessage(), 1;
}
?>
Expected result:
----------------
ceco@base ~/tmp/pg_last_notice
$ php test.php
NOTICE: 111111
Actual result:
--------------
ceco@base ~/tmp/pg_last_notice
$ php test.php
1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32223&edit=1