php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29322 Constant SID already defined with session_regenerate_id()
Submitted: 2004-07-22 11:41 UTC Modified: 2004-08-02 11:37 UTC
From: olivier dot bichler at laposte dot net Assigned: sas (profile)
Status: Not a bug Package: Session related
PHP Version: 5CVS-2004-07-22 (dev) OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: olivier dot bichler at laposte dot net
New email:
PHP Version: OS:

 

 [2004-07-22 11:41 UTC] olivier dot bichler at laposte dot net
Description:
------------
session_regenerate_id() destroy the false constant : it destroy the constant sid in lower case instead of the constant in upper case...

In PHP sources :
/* if the SID constant exists, destroy it. */  zend_hash_del(EG(zend_constants), "sid", sizeof("sid"));

should maybe be

/* if the SID constant exists, destroy it. */  zend_hash_del(EG(zend_constants), "SID", sizeof("SID"));

(file session.c)

(Please excuse me for my bad english ;-))

Reproduce code:
---------------
<?php
define('sid', 'essai');

session_start();
session_regenerate_id();

echo SID."\n";
echo sid;
?>

Expected result:
----------------
jg9vejq8p3e15lfu34vbouc6j3
essai

Actual result:
--------------
Notice: Constant SID already defined in D:\essai.php on line 5

Notice: Use of undefined constant sid - assumed 'sid' in D:\essai.php on line 8
sid

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-02 11:02 UTC] derick@php.net
Sascha, is he right?
 [2004-08-02 11:10 UTC] sas@php.net
SID is not a CS constant.
 [2004-08-02 11:37 UTC] tony2001@php.net
Sascha, but _empty_ SID constant is defined with 1 (i.e. CONST_CS).
See ext/session/session.c:1063
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 14 00:01:34 2024 UTC