FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » GLOBALS.php "Bug"??
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: GLOBALS.php "Bug"?? [message #165129 is a reply to message #165127] Sat, 30 April 2011 08:39 Go to previous message
Dayo is currently offline  Dayo   United Arab Emirates
Messages: 101
Registered: April 2011
Karma:
Senior Member
Quote:
From the bottom of my heart I do not mean any offense

No offense taken at all and I hope none is given by my posts as well.

Quote:
If that makes sense?

It does, 100% ... and makes my point as well which perhaps I have not been able to explain clearly enough.

I know what the variable scope is and what needs to be done with respect to this.

My point is precisely that putting items that will not change during the lifetime of the request into variables and then having to do the scope shuffle is a structural weakness or to put it bluntly, the result of a poor design choice.

All the variables in GLOBALS.php should have been either:

1. Declared explicitly as "GLOBALS['XYZ']" and always referenced as "GLOBALS['XYZ']". In this way, they will always be in the global scope wherever GLOBALS.php is included and since they are always referenced as such, in the situation I described earlier, I wouldn't need to be declaring globals this and globals that in my function. At present I have to declare "globals Every, Single, Variable, In, GLOBALS, Dot, PHP, One, By, One" or at least "globals Every, Single, Variable, In, GLOBALS, Dot, PHP, Used, In, The, Functions, I, Need, One, By, One" which is not good.

2. Defined as constants. The values are not going to change so why put them in variables instead of constants and then start doing the scope shuffle? If GLOBALS.php had contained "define('CONFIG_XYZ', 'abc')", whenever you need the value, all you do is use "CONFIG_XYZ" and that will be that.

3. Make it a class. Include and refer to class variables


However, you have chosen to do it the way it is now and of course I realise that the way it is currently set up makes no big difference internally within the application since you just use "$XYZ" or "GLOBALS['XYZ']" as required, but the reality is that if you had been delibrately trying to make the application unfriendly and difficult to extend/integrate, you couldn't have done a better job.

This loose structure fills every aspect of the code I have looked at. There are functions that appear as many times as the number of themes plus one. Grep one of the the functions db.inc and you will find it appearing multiple times in different places. This is bad, bad, bad ... but I don't want to go there now and just hope what I am saying about the GLOBALS.php thing is understood at this point.

[Updated on: Sat, 30 April 2011 08:44]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SQL Error has occurred...
Next Topic: NNTP Import Subject with Non-Ascii Characters
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 06:13:34 GMT 2024

Total time taken to generate the page: 0.03881 seconds