php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #16800 problem with registration an array variable in session
Submitted: 2002-04-24 12:28 UTC Modified: 2002-04-24 14:48 UTC
From: comsoso at comail dot ru Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.1.2 OS: linux
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: comsoso at comail dot ru
New email:
PHP Version: OS:

 

 [2002-04-24 12:28 UTC] comsoso at comail dot ru
I've tried to register a seesion variable $array[$i] with sessionn_register(), where $i is an integer index, but failed. In a temporary session file in my /tmp directory I found a declaration like !array[0]|, and now values.
Please help! Thanks

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-24 12:46 UTC] derick@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
 [2002-04-24 12:47 UTC] daniel@php.net
arrays can't be registered in sessions. However, you can store a serialized array:

  $arr = serialize($array);
  session_register($arr);

-daniel
 [2002-04-24 12:49 UTC] daniel@php.net
I made it a documentation problem. The manual page for 'session_register()' should explicitly mention this.
 [2002-04-24 13:44 UTC] postings dot php dot net at hans-spath dot de
@ daniel@php.net:

I hope that should be a bad joke ...

I've tested the code below with 4.1.1 and it worked.
(session support is broken in 4.1.2 AFAIK)

$bar = array(
	'something' => array( 1,2,3,4 ),
	'nothing' => NULL,
	'test' => true,
	'test2' => array( 'x','y'=>2 )
);
session_register('bar');
 [2002-04-24 14:23 UTC] mfischer@php.net
Just my 2cents: I also hope this is a bad joke. I haven't used sessions for quite some time but I know definitely that I've fucked the session_register() function with all kind of variables including arrays and objects and it worked (without needing to serialize them before ....) back when I used them.
 [2002-04-24 14:48 UTC] daniel@php.net
It was not meant to be entertaining. I was serious, but it turned out to be an user error - sorry for the false alarm.

Here's the typo:

  session_register("arr");

instead of

  session_register($arr);

damn :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 03:01:31 2024 UTC