Home »
FUDforum Development »
Bug Reports »
Problem with FUDforum API global variables (Global variable visibility issue when GLOBALS.php outside global scope)
Problem with FUDforum API global variables [message #161922] |
Sun, 21 February 2010 03:31 |
jlundan
Messages: 4 Registered: February 2010 Location: Finland
Karma:
|
Junior Member |
|
|
Hi,
I just started using the FUDApi and I ran to a small problem. It seems that FUDApi uses a bunch of global variables which are defined in GLOBALS.php and which should be included before using the FUDApi.
The GLOBALS.php expects to be run in global scope because it does not use either global keyword or $GLOBALS array while defining its variables. In other words, GLOBAL.php uses format:
$FUD_OPT_1 = 1737422013;
instead of for example
$GLOBALS['FUD_OPT_1'] = 1737422013;
The problem comes when I try to include the GLOBALS.php from inside a framework, such as CodeIgniter. In these cases my code is already inside a framework class or a method and I cannot go out of it. This means if I include the GLOBALS.php, the variables inside it are no longer global scoped but inside the scope of my framework class/method.
This causes FUDApi to crash with error message like "undefined index 'FUD_OPT_1'. The problem can be solved by modifying the GLOBALS.php to use $GLOBALS array.
|
|
|
Goto Forum:
Current Time: Sun Dec 01 10:57:02 GMT 2024
Total time taken to generate the page: 0.03189 seconds