$_SESSION[rString] HELP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danp_canucks
Forum Newbie
Posts: 4
Joined: Tue Aug 15, 2006 3:57 am

$_SESSION[rString] HELP

Post by danp_canucks »

Hi everyone!

I'm making a addition to a client's website. They have the following variable everywhere $_SESSION[rString]. Also they are not using session_start() , session_register(), or define("rString", foo) anywhere in the site. There are no errors on their site when proccessing this statement. My question is what could this possibly be. I'm not really a newbie, but I have not come across anything like this.
I would very much appreciate any input you may have.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

It's a session variable, oddly enough.

although session_register() is regarded as deprecated, and any session variables/values should be assigned directly to the $_SESSION superglobal array. (simply put: $_SESSION['var'] = 'val'; )

The last snip (define('rString', 'foo'); ) is a constant.

Are you experiencing any particular problems?
Last edited by Jenk on Tue Aug 15, 2006 4:14 am, edited 1 time in total.
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

- isn't it in some required/included file?
- don't they use session.auto_start?
- isn't error_reporting disabled?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Moved to PHP - Code
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Echo out the two things and see what is coming out of them...

Code: Select all

<?php
echo rString;
echo $_SESSION[rString];
?>
danp_canucks
Forum Newbie
Posts: 4
Joined: Tue Aug 15, 2006 3:57 am

Post by danp_canucks »

Thank You all for the responses.
I will address each of your comments individually:

-The live site works perfectly fine
-This is a third party project and I don't have access to the server, so I cannot play around with the settings, or upload test files. All I have are the site files and database dump.

-I could rebuild the file structure on my system and check it that way, but it's way too complicated and they are not paying me enough to do so.

-I checked all the included/required files, nowhere is rString defined.

I am beginning to lean to the hypothesis that they disabled error reporting, but $_SESSION[rString] appears way too often, and clearly the programming was done by an advanced programming judging from the rest of the code.

Is there anything else it could be? I know it's a bit of a vague description, and I would be happy to answer any other question.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

it could be something that was left behind from a previous modification or change.

One thing you can do is make absolute certain they haven't left out any files when sending them to you (forgive my ignorance if you have done so already - and don't forget the index file!)

:)
PapiSolo
Forum Newbie
Posts: 24
Joined: Wed Aug 09, 2006 12:16 pm

Post by PapiSolo »

Just a dumb question from a newbie... but have you tried commenting out that bit of code and testing to see wether all works OK?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

danp_canucks wrote:I am beginning to lean to the hypothesis that they disabled error reporting, but $_SESSION[rString] appears way too often, and clearly the programming was done by an advanced programming judging from the rest of the code.
What exactly about this leads you to believe it was an advanced developer? Error reporting is disabled by default in a lot of hosted environments. Relying on it a bad practise. Most developers worth their salt will develop their apps to the most strict environment (E_ALL error reporting and display_errors on) just to make sure the stuff works properly.

Just a question, that's all.
danp_canucks
Forum Newbie
Posts: 4
Joined: Tue Aug 15, 2006 3:57 am

Post by danp_canucks »

Thank You for the replies

I wish I could perform live testing of the code, but not having access to the server severly limits me in what I can do to test.

I am absolutely sure that I have all the include files that are refered to in the code and rString is not defined anywhere.

The reason why I think that the code is written by an advanced programmer is because the site is written in an OOP paradigm. The site is huge (several hundred pages), and the OOP does a lot to help with writing clean and efficient code.

Is it possible that it's a reference to some Flash ActionScript variable?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

It could very well be a mistake. Using an unquoted array index is acceptable, but not recommended. PHP has to guess what you mean when you leave the quotes off. And just because there are 100 pages of code that appears to be OOP, doesn't mean it was an advanced developer.

Getting to my next point, if you have access to the code, why not set the code up on your own computer (making your computer a server is fairly easy). Then you can turn error reporting on locally and see exactly what is happening on the server.
danp_canucks
Forum Newbie
Posts: 4
Joined: Tue Aug 15, 2006 3:57 am

Post by danp_canucks »

Thanks Everah,

Perhaps you are right.


I could rebuild the file structure on my system and check it that way, but it's complicated and they are not paying me enough to do so.

I guess I'm just gonna leave it as is, and move on.

Thank You everyone
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Your approach... is a good approach. Let them have what they pay for. Good luck in your endeavors in PHP. And remember to visit here often for some really weird late night conversations and really good PHP learning.
Post Reply