|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-25 14:30 UTC] sniper@php.net
[2005-01-26 03:58 UTC] rich at tallman dot org
[2005-01-26 04:17 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 26 07:00:01 2025 UTC |
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.