From:             rich at tallman dot org
Operating system: Linux
PHP version:      4.3.9
PHP Bug Type:     Scripting Engine problem
Bug description:  Some postgres features fail when used with $_SESSION 
superglobal

Description:
------------
pg_last_notice() fails in very specific circumstances. The failure seems
to happen under only a very specific set of circumstances.

- The $_SESSION superglobal is used to hold a db connection resource.
- There is an active session.
- The database connection is made in an included file.

Reproduce code:
---------------
<? // filename - thisworks.php
session_start();
$_SESSION["dbconn"]=pg_connect("dbname=meridican user=postgres
password=");
$result=pg_query($_SESSION["dbconn"],$sql);
echo pg_last_notice($_SESSION["dbconn"]); ?>

<? // filename - thisdoesntwork.php
session_start();
include("dbconn.php");
$result=pg_query($_SESSION["dbconn"],$sql);
echo pg_last_notice($_SESSION["dbconn"]); ?>

<? // filename - dbconn.php
$_SESSION["dbconn"]=pg_connect("dbname=meridican user=postgres
password="); ?>


Expected result:
----------------
In the example, the output from thisworks.php is the notice raised by
postgres. The same result could be expected from the nearly identical code
run in thisdoesntwork.php.

Actual result:
--------------
In actuality, thisdoesntwork.php outputs a blank. 

-- 
Edit bug report at http://bugs.php.net/?id=31685&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31685&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31685&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31685&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31685&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31685&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31685&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31685&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31685&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31685&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31685&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31685&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31685&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31685&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31685&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31685&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31685&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31685&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31685&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31685&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31685&r=mysqlcfg

Reply via email to