Page 1 of 1

Basic Global Variable / OOP question

Posted: Thu Nov 22, 2007 10:59 am
by benxmy
hi,
I'm wondering if using something like:

Code: Select all

global $myvar;
has any security implications (register_globals is turned 'off'). I'm a bit confused about using the above syntax vs. doing something like setting $myvar to a session variable and what the scope of the variable would be if I use global $myvar in a class I create. I can test the scope stuff, but I wanted to be sure I'm clear on the security issues. Thanks for any help!

Posted: Thu Nov 22, 2007 11:34 am
by feyd
Use of the global keyword is a (bad) code smell. Not necessarily due to security, but due to poor application/code design.