Why use `global $app` in Toolbar Class? |
Hi, I found the "global $app;" used in the prepare method of the "CodeIgniter\Debug\Toolbar" Class.
In the new version of CodeIgniter4 we can use "\Config\Services::codeigniter()" to get the shared CodeIgniter entity. So I'm not sure if using "global $app;" is needed. Since I am doing some work for CodeIgniter4 to support high performance servers (RoadRunner & WorkerMan), so "global $app;" is a problem that bothers me.
Probably just because the code was written before Services::codeigniter() was added.
We changed "global $app;" to "$app = \Config\Services::codeigniter();" and run unit test below of "tests/system/Debug/" folder, It looks like doesn't have any problem.
Does this change need to be modified at next version?
This was fixed in develop, and will be fixed in v4.2.7.
See https://github.com/codeigniter4/CodeIgniter4/pull/6524 |
Welcome Guest, Not a member yet? Register Sign In |