From: m at saffitz dot com
Operating system:
PHP version: 5CVS-2004-05-21 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Variable dropping value with Sessions and PEAR::Log
Description:
------------
I have a simple session handler which uses a postgres
database for storage, and Pear::Log for logging. A
script with all necessary code for reproduction is
below.
When I run the code as is (obviously adding in db
parameters), the code runs without errors, but the path
to the log is inserted as the id in the database instead
of the session id.
There are two independent changes I can make to avoid
this behavior:
1) Use a shorter path for the log file. Using /log.log
and the script functions as expected.
2) Switch lines 52 and 53, and 56 and 57, (i.e. to:
$sql = "insert into sessions (id,datavalue) values
('$id','$val')";
$this->logger->log("Not found, inserting");
With the lines switched the script functions as
expected.
I've seen this bug on Mac OS X and Fedora Core 1.
Reproduce code:
---------------
http://www.saffitz.com/phperr.phps
Session Table Definition:
Table "public.sessions"
Column | Type | Modifiers
-------------------+------+----------------------
id | character varying(255) | not null
created_date | date | not null default
'2004-05-15'::date
modification_date | timestamp without time zone | not null default
'2004-05-15 00:35:58.094778'::timestamp without time zone
datavalue | text |
Indexes: sessions_pkey primary key btree (id)
Expected result:
----------------
Session is populated correctly in the database (with
correct id), and the count printed to the screen
increments with each refresh.
Actual result:
--------------
Session is incorrectly populated in the database (path
to log file is populated instead), and the count on the
screen is not incremented.
--
Edit bug report at http://bugs.php.net/?id=28475&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28475&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28475&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28475&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28475&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28475&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28475&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28475&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28475&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28475&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28475&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28475&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28475&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28475&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28475&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28475&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28475&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28475&r=float