Basic Global Variable / OOP question

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
benxmy
Forum Newbie
Posts: 3
Joined: Fri Sep 15, 2006 10:43 am

Basic Global Variable / OOP question

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Use of the global keyword is a (bad) code smell. Not necessarily due to security, but due to poor application/code design.
Post Reply