RE: [PHP] Stopping objects from auto-serializing

This is a discussion on RE: [PHP] Stopping objects from auto-serializing within the PHP General forums, part of the PHP Programming Forums category; > -----Original Message----- > From: David Christopher Zentgraf [mailto:deceze@gmail.com] > Sent: 31 October 2007 08:04 > ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-31-2007
Ford, Mike
 
Posts: n/a
Default RE: [PHP] Stopping objects from auto-serializing

> -----Original Message-----
> From: David Christopher Zentgraf [mailto:deceze@gmail.com]
> Sent: 31 October 2007 08:04
> To: PHP
> Subject: Re: [php] Stopping objects from auto-serializing
>
>
> After some more playing around and a lot of print_r($SESSION)'s:
>
> This specific PHP configuration seems to replace every entry in
> $_SESSION if a variable with the same name is used in the
> main script
> with that variable.
>
> I.e.
> session_start() // $_SESSION["foo"] is now "bar"
> $foo = "12345";
> $var = "xxxx";
>
> function test() {
> $foo = "67890";
> }
> test();
>
> After execution finished $_SESSION["foo"] is now "12345", but
> there's
> no $_SESSION["var"].
> What's going on here?


That's exactly the behaviour caused by register_globals being on --
session_start() takes each $_SESSION["var"] and makes the equivalent
global $var be a reference to it. Other variables only get mirrored in
$_SESSION if you session_register() them.

(track_vars, mentioned previously, is a red herring -- it's been
permanently enabled since 4.0.something.)
Cheers!

Mike

------------------------------------------------------------------------
----------------
Mike Ford, Electronic Information Services Adviser,
JG125, The Headingley Library, James Graham Building,
Headingley Campus, Beckett Park, LEEDS, LS6 3QS
United Kingdom
Tel: +44 113 812 4730 Fax: +44 113 812 3211


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:01 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0