ID: 31685 User updated by: rich at tallman dot org Reported By: rich at tallman dot org -Status: Bogus +Status: Open Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.3.9 New Comment:
I am not suggesting that database resource should be valid later in a session. I am simply pointing out that the value is corrupted within the execution of the same page. This is definitely a bug. You can choose not to fix it, but perhaps then you can document that the $_SESSION variable is not ACTUALLY superglobal, and may not retain values between included pages. Previous Comments: ------------------------------------------------------------------------ [2005-01-25 14:30:31] [EMAIL PROTECTED] DB connection resources can not be passed along within sessions -> We're not gonna 'fix' anything here. ------------------------------------------------------------------------ [2005-01-25 09:11:16] rich at tallman dot org 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 this bug report at http://bugs.php.net/?id=31685&edit=1