473,664 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WTF!? - $_SESSION passes vars BUT NOT ARRAYS!?!?!?!?! ?!

h
I am at my wits end; I can not see A SINGLE THING I'm doing wrong. I've
read every fricking session related doc. I've searched every fricking
group.
NO ONE seems to have had the problem I'm having - and it doesn't make
ANY sense.

I'm running php 4.3.3 on a local server; and 4.3.10 on my isp's web
server.
I've tested this on both with the same results.

all I fricking want to do is pass an array from 1 script to the next -
sure sounds simple enough - right?

here's my code:
_______________ _______________ _______________ _______________ ______________
TEST1.PHP:
session_start() ;

$myarr=array(); $hw='hello world! (of course!)';
$_SESSION['hw']=$hw;
$_SESSION['1']='purple people eater'; $_SESSION['house']='1 eyed 1
house pppe';
$myarr['2']='purple people eater'; $myarr['home']='1 eyed 1 house
pppe';

$_SESSION['myarr']=$myarr;
$_SESSION['smyarr']=serialize($mya rr); // I should NOT have to do this

print_r($_SESSI ON); // YES - all the var's actually have stuff in 'em
print '<BR><BR>myarr: <BR> '; print_r($myarr) ; print '<BR><BR>';
print 'smyarr:<BR> '; print_r($_SESSI ON['smyarr']); print '<BR><BR>';
print '<BR><A href="test2.php ">continue here</a>';
_______________ _______________ _______________ _______________ ______________
TEST2.PHP:
session_start() ;

echo '<BR><BR>_REQUE ST:<BR> '; // should be no point, but I'm trying
anything
print_r($_REQUE ST); // of course, my SID is in here - no surprise.
echo '<BR><BR>_SESSI ON:<BR> ';
print_r($_SESSI ON);
// this SHOULD have my arrays! but it doesn't even have
// my serialized string !!!!!!!!!!!!! HOW CAN THAT BE!?!?!?!?!?
// if $hw passes thru - which it does - how can smyarr NOT pass?!?!
_______________ _______________ _______________ _______________ ______________
Here's the results from test2.php:
_SESSION:
Array ( [hw] => hello world! (of course!) )
// where the blank is all my other stuff!?!
_______________ _______________ _______________ _______________ ______________

would be most appreciative, and eternally grateful if anyone could tell
me what my problem is!! (my programming problem that is :-)

tia - Bob
PS: my REAL email has the 3 letters reversed - ie: abc=cba

Jul 17 '05 #1
5 1853
h@s@n@starnetwx .net wrote:
I am at my wits end; I can not see A SINGLE THING I'm doing wrong. I've read every fricking session related doc. I've searched every fricking
group.
NO ONE seems to have had the problem I'm having - and it doesn't make
ANY sense.

I'm running php 4.3.3 on a local server; and 4.3.10 on my isp's web
server.
I've tested this on both with the same results.

all I fricking want to do is pass an array from 1 script to the next - sure sounds simple enough - right?

here's my code:

<... SNIP CODE ...>

You cannot have numeric keys into $_SESSION, $_GET, $_POST, etc.

--
Oli

Jul 17 '05 #2
h
hi Oli -

True enough - but none of my keys are numeric - they're strings that
happen to use a number - right?

$_SESSION['1']='purple people eater';
$myarr['2']='purple people eater';
<<

tia - Bob

Jul 17 '05 #3
h
well - SOB !

I THOUGHT those numbers would be treated as strings, because I quoted
them - apparently not!

removed them and things are right in the world again!!

1M TX, Oli; although still not sure why a number treated as a string
would cause problems...

Bob

Jul 17 '05 #4
h@s@n@starnetwx .net wrote:
well - SOB !

I THOUGHT those numbers would be treated as strings, because I quoted
them - apparently not!

removed them and things are right in the world again!!

1M TX, Oli; although still not sure why a number treated as a string
would cause problems...


I think it must be a throwback to allow register_global s to work.

When register_global s is enabled, $_SESSION['monkey'] becomes $monkey.
Therefore a variable such as $_SESSION[1] (or $_SESSION['1']) would
become $1, which is obviously not a valid variable name.

The only way to resolve this is not to allow $_SESSION[1] in the first
place.

--
Oli

Jul 17 '05 #5
h

Oli Filth wrote:
h@s@n@starnetwx .net wrote:
I THOUGHT those numbers would be treated as strings, because I quoted them - apparently not!

removed them and things are right in the world again!!

1M TX, Oli; although still not sure why a number treated as a string would cause problems...

I think it must be a throwback to allow register_global s to work.

When register_global s is enabled, $_SESSION['monkey'] becomes

$monkey. Therefore a variable such as $_SESSION[1] (or $_SESSION['1']) would
become $1, which is obviously not a valid variable name.

The only way to resolve this is not to allow $_SESSION[1] in the first place.

--
Oli


That, at least, makes some sense!

TX again, Oli!
-Bob

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2047
by: Jonas Kölker | last post by:
so, I've read the manuals, done a few hacks, read the quick reference. however, one thing still eludes me: what (the hell) is Ellipsis? what's it good for? how do I use it; how does the interpreter use it? .... thanks everybody, Jonas Kölker
4
1044
by: silangdon | last post by:
<rant> I've spent 30 minutes trying to find information on the CString left function. in VC6 you get MFC class & a complete list of operators. And an overview. This seems to be entirely absent or hard to find. I _hate_ it when software gets worse, not better. </rant>
29
3509
by: Ron Garret | last post by:
>>> u'\xbd' u'\xbd' >>> print _ Traceback (most recent call last): File "<stdin>", line 1, in ? UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in position 0: ordinal not in range(128) >>>
1
1314
by: Noah Roberts | last post by:
I have code that looks like the following: void f() { Object * p = 0; Object * p2 = availableptr; Object * iter = 0; std::map<int,intserialMap; // also tried std::map<int,intserialMap = std::map<int,int>() even though I can't fathom what happened the first way.
2
1177
by: Curt | last post by:
Thank God for backups. This is the 3rd time this kind of crap pops up. I have not been in the module these errors reference in a month. But now my app will not build because of this crap. Any assistance would be most appreciated. To Date, this kind of stuf has cost me about 2-3 days work.
0
1020
by: Mr. SweatyFinger | last post by:
on some user controls i get page load events on others not. wtf is going on
7
1679
by: Mr. SweatyFinger | last post by:
I downloaded t he time tracker starter kit. Now where the hell is it? honest to god what is the problem. And no it is not under "n ew project/ starter kits" I mean how much of a hassle can they make this crap? do they work really hard at making no sense at all?
2
4609
by: GilBates | last post by:
I was kind of expecting to see a "test" message pop up when I clicked the submit button, but NNNNOOOOOOOOOOO! wtf gives? <form method="post" onsubmit="javascript:window.alert('test');" action="http://www.botworks.com/local/BWIForm.pl" target=_blank name="BWIForm" > <input type=hidden name="BWI_last_mode" value="review"> <input type=hidden name="BWI_action" value="Search"> <select name="BWI_table_name"> <option value="book">book <option...
0
1403
by: paulcybulski | last post by:
OK here is my issue...I have a main map with a minimap which has a selection box that displays the current view of the main map...you can zoom by way of mouse wheel scroll, +/- buttons, and a wheel which you can click/drag and turn to zoom in and out...thats all fine and dandy, but when you zoom to the max, the selection box in the minimap is slightly shifted out of place...I have a reset function that resets to the original position and...
0
1036
by: mrkafk | last post by:
So I set out to learn handling three-letter-acronym files in Python, and SAX worked nicely until I encountered badly formed XMLs, like with bad characters in it (well Unicode supposed to handle it all but apparently doesn't), using http://dchublist.com/hublist.xml.bz2 as example data, with goal to extract Users and Address properties where number of Users is greater than given number. So I extended my First XML Example with an error...
0
8437
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.