#31685 [Opn->Bgs]: Some postgres features fail when used with $_SESSION superglobal

From: Date: Tue, 25 Jan 2005 13:30:34 +0000
Subject: #31685 [Opn->Bgs]: Some postgres features fail when used with $_SESSION superglobal
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-72781@lists.php.net to get a copy of this message
ID: 31685 Updated by: sniper@php.net Reported By: rich at tallman dot org -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.3.9 New Comment: DB connection resources can not be passed along within sessions -> We're not gonna 'fix' anything here. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#72781) next »