php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14880 _SESSION will NOT automatically register it as a session variable
Submitted: 2002-01-05 21:52 UTC Modified: 2002-03-16 22:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: 247net at gmx dot net Assigned:
Status: Closed Package: Session related
PHP Version: 4.1.0 OS: Debian 3.0 (Woody)
Private report: No CVE-ID: None
 [2002-01-05 21:52 UTC] 247net at gmx dot net
<?
function func1(){
  echo "Set iVar<br>";
  $_SESSION["iVar"] = 8;
}
function func2(){
  echo "\$_SESSION[iVar] ".$_SESSION[iVar]."<br>";
}
session_start();

if ($_REQUEST["action"] != "page2"){
  func1();
}

func2();

if (session_is_registered("iVar") == FALSE){
  echo "iVar is not registered<br>";
}
echo "<a href='$PHP_SELF?action=page1'>page1</a><br>";
echo "<a href='$PHP_SELF?action=page2'>page2</a><br>";
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-06 07:16 UTC] 247net at gmx dot net
<?
session_start();
$_SESSION["foo"] = "bar";

if (session_is_registered("foo") == FALSE){
  echo "foo is not registered<br>";
}else{
  echo $_SESSION["foo"];
}
?>
 [2002-01-06 22:33 UTC] yohgaki@php.net
It works for me with 4.2.0-dev.
What is your configure line and related ini setting?
 [2002-01-07 08:33 UTC] 247net at gmx dot net
I'll hope this helps.
btw. I've tried it at a second system (debian to:) => foo is not registered

Configure Line (apt-get):)
 '../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs' '--with- regex=system' '--with-config-file-path=/etc/php4/apache' '-- disable-rpath' '--disable-debug' '--enable-memory-limit' '--enable- calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-track- vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable- ctype' '--with-db2' '--with-iconv' '--with-ndbm' '--enable-exif' '-- enable-filepro' '--enable-ftp' '--with-gettext' '--enable-mbstring' '-- enable-mbstr-enc-trans' '--with-pcre-regex=/usr' '--enable- shmop' '--enable-sockets' '--enable-wddx' '--with-xml=/usr' '-- with-expat-dir=/usr' '--enable-yp' '--with-zlib' '--without-pgsql' '-- disable-static' '--with-layout=GNU' '--with-curl=shared,/usr' '-- with-dom=shared,/usr' '--with-zlib-dir=/usr' '--with-gd=shared,/ usr' '--with-jpeg-dir=shared,/usr' '--with-xpm-dir=shared,/usr/ X11R6' '--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/ usr' '--with-imap=shared,/usr' '--with-ldap=shared,/usr' '--with- mcal=shared,/usr' '--with-mhash=shared,/usr' '--with-mm' '--with- mysql=shared,/usr' '--with-recode=shared,/usr' '--with- sablot=shared,/usr' '--with-snmp=shared' '--with-sybase- ct=shared,/usr' '--with-ttf=shared,/usr' '--with-t1lib=shared,/usr'


Session enabled
session.auto_start Off
session.cache_expire 180
session.cache_limiter nocache
session.cookie_domain no value
session.cookie_lifetime 0
session.cookie_path /
session.cookie_secure Off
session.entropy_file no value
session.entropy_length 0
session.gc_maxlifetime 1440
session.gc_probability 1
session.name PHPSESSID
session.referer_check no value
session.save_handler files
session.save_path /tmp
session.serialize_handler php
session.use_cookies On

 [2002-01-07 13:43 UTC] 247net at gmx dot net
It doesn't work with 4.1.1 too. 
btw. I haven't modified the config.

cheers,

Marcus.


 [2002-01-09 22:09 UTC] yohgaki@php.net
Could you try 4.2.0-dev?
http://snaps.php.net/
 [2002-01-10 07:00 UTC] 247net at gmx dot net
> Could you try 4.2.0-dev?
yeap, if I could reach the server. (down at the moment)

btw. I tried it with php4.1.1 and PHPEd on Win32 (no apache)
=> foo is not registered<br>
 [2002-01-11 00:14 UTC] hideki at matsumura dot club dot ne dot jp
I am troubled by the same problem.

* OS: Red Hat 6.2 (Zoot) Kernel 2.2.14-6.1.1smp
* PHP: 4.1.0, 4.2.0-dev/200112191500

/tmp/sess_XXX is created, but never store variables(zero size).
 [2002-01-11 00:25 UTC] yohgaki@php.net
I don't have problem with files handler (4.1.0, 4.1.1, 4.2.0-dev)
Get rid of most configure options see if it works.

 [2002-01-11 09:08 UTC] 247net at gmx dot net
Could you please post your configline?
I get rid of most of the configline => same outcome

 '../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs' '--with- regex=system' '--with-config-file-path=/etc/php4/apache' '-- disable-rpath' '--disable-debug' '--enable-memory-limit' '-- enable-trans-sid' '--with-pcre-regex=/usr' '--without-pgsql' '-- disable-static' '--with-layout=GNU' '--with-mm'
 [2002-01-12 21:05 UTC] yohgaki@php.net
What is your session save handler? mm?
If so, you *MUST* use session_module_name() before starting session to use mm save handler for now. (There is bug in module loading.... It's a known issue ;) For some reason, mm save hanlder stopped working for me recently :(

Anyway. Here is my configure.

'./configure' \
'--with-apxs' \
'--without-mysql' \
'--with-bz2' \
'--with-crack=/usr/local' \
'--with-curl' \
'--with-ftp' \
'--with-iconv' \
'--with-mhash' \
'--with-mcrypt' \
'--with-msession' \
'--with-mm' \
'--with-openssl' \
'--with-pgsql' \
'--with-regex=system' \
'--with-zlib' \
'--with-dom' \
'--with-dom-xslt' \
'--with-snmp' \
'--with-gd' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr' \
'--with-jpeg-dir=usr' \
'--with-png-dir=/usr' \
'--with-xpm-dir=/usr/X11R6' \
'--enable-ctype' \
'--enable-shmop' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-sockets' \
'--enable-mbstring' \
'--enable-mbstr-enc-trans' \
'--enable-mbregex' \
'--enable-memory-limit' \
'--enable-wddx' \
'--enable-mailparse' \
'--with-xml' \
'--with-xmlprc' \
'--enable-debug' \

 [2002-01-13 12:31 UTC] 247net at gmx dot net
I tried both. (files/mm)
I killed my dev-system and I'm to busy to fix it. I'm out for a month. (I have exams and I must learn!)
Thanks for your patience.
 [2002-02-03 20:05 UTC] yohgaki@php.net
To reporter: Just a reminder. Please report the result when you check
 [2002-02-14 02:31 UTC] 247net at gmx dot net
I've looked at the (updated) documentation.

--snip
If you are using $HTTP_SESSION_VARS/$_SESSION, do not use session_register(),  session_is_registered() and session_unregister() unless you know internal of session module.
--snap

that's it!

thx yohgaki

btw. the following works

session_start();
$_SESSION["foo"] = "foo is registered";

if ($_SESSION["foo"]){
  echo $_SESSION["foo"];
  }else{
 echo "foo is not registered<br>";
}


 [2002-03-16 19:17 UTC] stevenw at server101 dot com
I am running 4.2.0-dev also and $_SESSION is not stored properly i.e. not accessible after it has been set.

e.g.
<?
session_start();
if ($_SESSION["foo"]){
    echo $_SESSION["foo"];
}else{
    echo "foo is not registered<br>";
    $_SESSION["foo"] = "foo is registered";
}
?>

so first time through, it should set it - subsequent reloads it should be already set?
 [2002-03-16 22:24 UTC] yohgaki@php.net
Your PHP is too old, try current CVS version.
If you still have the problem, could you open _new_ bug report? (Since the cause would be differ from originally reported)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC