Page 1 of 1
$_SESSION[rString] HELP
Posted: Tue Aug 15, 2006 4:08 am
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.
Posted: Tue Aug 15, 2006 4:13 am
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?
Posted: Tue Aug 15, 2006 4:13 am
by MarK (CZ)
- isn't it in some required/included file?
- don't they use session.auto_start?
- isn't error_reporting disabled?
Posted: Tue Aug 15, 2006 4:26 am
by JayBird
Moved to PHP - Code
Posted: Tue Aug 15, 2006 5:32 am
by RobertGonzalez
Echo out the two things and see what is coming out of them...
Code: Select all
<?php
echo rString;
echo $_SESSION[rString];
?>
Posted: Tue Aug 15, 2006 8:51 am
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.
Posted: Tue Aug 15, 2006 9:01 am
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!)

Posted: Tue Aug 15, 2006 11:50 am
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?
Posted: Tue Aug 15, 2006 12:56 pm
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.
Posted: Tue Aug 15, 2006 5:16 pm
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?
Posted: Tue Aug 15, 2006 7:55 pm
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.
Posted: Wed Aug 16, 2006 1:37 am
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
Posted: Wed Aug 16, 2006 1:44 am
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.