global $option should be refactored - Joomla! Forum - community, help and support


hi, trying figure out, how mvc works, i've noticed dangerous global variable: $option, defined in index.php:

code: select all

$option = jrequest::getcmd('option');

i think it's dangerous , needs refactoring due these reasons:
- local variable same name: '$option' - used in more, thousand places in joomla core
- in places of code see duplication of above global variable: same assignment, above, local variable.

i suggest, quick fix, add $option public variable $mainframe (i.e. japplication class), usage of global variable clear visible , we'll rid of global variable, used in not many, in important places (e.g. in mvc core - don't this...):

code: select all

global $mainframe;
 ... $mainframe->option ...

a suggestion, leave future version. primary reason variable still available in global scope backwards compatibility 1.0 components , current 1.5 components. changing require quite lot of testing across whole codebase.





Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino DUE ADC to DAC Piezo 30 Khz-100Khz

Indesign and MathType fonts