# $_SESSION numeric index bug

- Thread: https://externals.io/message/48274
- Original archive: https://news-web.php.net/php.internals/48274
- Started by Mathias Grimm on 2010-05-13T15:25:25+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #48274 — Mathias Grimm — 2010-05-13T15:25:25+00:00

URL: https://externals.io/message/48274#48274

im using php 5.1.6 on xampp and i find a bug.
how to know if the bug was fixed?

the bug is:

1.
<?php
 `session_start()`;
$_SESSION[0] = 'test';
echo $_SESSION[0];

2.
<?php
 `session_start()`;
//$_SESSION[0] = 'test';
echo $_SESSION[0];

the expected was:
test

the result was:
notice...

after comment and reload, throws:
*
*
*Notice*: Undefined offset: 0 in *
C:\xampp_padrao\xampp\htdocs\indisponibilidade_patrimonial\index.php* on
line *4*
*
*
if dont use numeric index, it works!, but if index is numeric, bug!

if it was not fixed, a want to fix it, but i dont have cvs access

-- 
Att.
Mathias Grimm

http://mathiasgrimm.com.br
http://phpempregos.com.br

---

## #48275 — Mathias Grimm — 2010-05-13T15:39:30+00:00

URL: https://externals.io/message/48274#48275 · In reply to: #48274

i did the same on linux, with the same version of php and the bug is there!!


On Thu, May 13, 2010 at 12:25 PM, Mathias Grimm <mathiasgrimm@gmail.com>wrote:

> im using php 5.1.6 on xampp and i find a bug.
> how to know if the bug was fixed?
>
> the bug is:
>
> 1.
> <?php
> `session_start()`;
> $_SESSION[0] = 'test';
> echo $_SESSION[0];
>
> 2.
> <?php
> `session_start()`;
> //$_SESSION[0] = 'test';
> echo $_SESSION[0];
>
> the expected was:
> test
>
> the result was:
> notice...
>
> after comment and reload, throws:
> *
> *
> *Notice*: Undefined offset: 0 in *
> C:\xampp_padrao\xampp\htdocs\indisponibilidade_patrimonial\index.php* on
> line *4*
> *
> *
> if dont use numeric index, it works!, but if index is numeric, bug!
>
> if it was not fixed, a want to fix it, but i dont have cvs access
>
> --
> Att.
> Mathias Grimm
>
> http://mathiasgrimm.com.br
> http://phpempregos.com.br
>



-- 
Att.
Mathias Grimm

http://mathiasgrimm.com.br
http://phpempregos.com.br

---

## #48276 — johannes@schlueters.de — 2010-05-13T15:55:36+00:00

URL: https://externals.io/message/48274#48276 · In reply to: #48275

> > […]

5.1.6 is ooooold. Please test a newer version before reporting anything.
Secondly please consult regular support forums/groups
<http://php.net/support.php> for such questions, and bugs.php.net for
reporting bugs. This list is for working on the internals.

To your issue: That's related to the way the session module serializes
data, which is non-standard serialize due to register_globals. Most
likely php.next, where r_g is gone will use standard serialization where
this would be fixed. till then a session key has to be a string.

johannes

---

## #48277 — Etienne Kneuss — 2010-05-13T15:58:18+00:00

URL: https://externals.io/message/48274#48277 · In reply to: #48275

Hello,


> i did the same on linux, with the same version of php and the bug is there!!
>
>
> On Thu, May 13, 2010 at 12:25 PM, Mathias Grimm <mathiasgrimm@gmail.com>wrote:
>
> > […]
>
>
>
> --
> Att.
> Mathias Grimm
>
> http://mathiasgrimm.com.br
> http://phpempregos.com.br
>

5.1 is not supported anymore, try with 5.2 or 5.3 instead.

Best,

-- 
Etienne Kneuss

---

## #48278 — Arpad Ray — 2010-05-13T16:08:11+00:00

URL: https://externals.io/message/48274#48278 · In reply to: #48276

2010/5/13 Johannes Schlüter <johannes@schlueters.de>

> To your issue: That's related to the way the session module serializes
> data, which is non-standard serialize due to register_globals. Most
> likely php.next, where r_g is gone will use standard serialization where
> this would be fixed. till then a session key has to be a string.
>
>
Hi,

I have a patch ready for the standard serialisation which would indeed fix
this - I'll put together an RFC for it this week.

Regards,

Arpad

---

## #48279 — Derick Rethans — 2010-05-13T17:30:41+00:00

URL: https://externals.io/message/48274#48279 · In reply to: #48278

> 2010/5/13 Johannes Schlüter <johannes@schlueters.de>
> 
> > […]
> 
> I have a patch ready for the standard serialisation which would indeed 
> fix this - I'll put together an RFC for it this week.

right now, unserialize throws notices if there are problems decoding the 
string; it would be good if we could get rid of that too. (As a 
reference: http://trac.qcu.be/projects/qcubed/ticket/555

regards,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

---

## #48281 — Ferenc Kovacs — 2010-05-13T19:09:19+00:00

URL: https://externals.io/message/48274#48281 · In reply to: #48279

Something like http://hu2.php.net/json_last_error should be implemented for
serialize.

Tyrael



> 
>
> > […]
> where
> > […]
>
> right now, unserialize throws notices if there are problems decoding the
> string; it would be good if we could get rid of that too. (As a
> reference: http://trac.qcu.be/projects/qcubed/ticket/555
>
> regards,
> Derick
>
> --
> http://derickrethans.nl | http://xdebug.org
> Like Xdebug? Consider a donation: http://xdebug.org/donate.php
> twitter: @derickr and @xdebug
