I used Jumi component in order to insert php scripts into Joomla. And the problem with global vars was related to Jumi.
I tried another similar component called Sourcerer and now everything is working ok.
문제
I have Joomla and some external php scripts and libraries. There is a main library where I declare some global vars.
lib.php
global $var_glb; $var_glb="some_value";
script.php:
require_once(lib.php);
print_r($var_glb) //Notice: Undefined variable
print_r$GLOBALS['var_glb']); //DEFINED!
global $var_glb; print_r($var_glb) //DEFINED!
So I had to put "global" in front of $var_glb in order to be accessible... normally it should be defined without "global"...
I don't know why $var_glb (without "global") is lost and only $GLOBALS['var_glb'] is accessible or when using "global $var_glb"
Why is that happening? I don't want to redeclare all global vars in the script.
해결책
I used Jumi component in order to insert php scripts into Joomla. And the problem with global vars was related to Jumi.
I tried another similar component called Sourcerer and now everything is working ok.