Summary
All calls to globals_get() and globals_set() for known ORM/DB settings keys should be replaced with Settings::get() and Settings::set() from Phalcon\Support\Settings.
Motivation
Settings::get() checks PHP-level overrides first, then falls back to globals_get(). Settings::set() stores values at the PHP level only and does not call globals_set(). This prevents settings from one project leaking into another when they share the same PHP worker process.
How This Will Be Fixed
Each of the 9 affected .zep files will be updated as follows:
- Add
use Phalcon\Support\Settings; to the file's imports.
- Replace every
globals_get("key") call (for a known Settings key) with Settings::get("key").
- Replace every
globals_set("key", value) call with Settings::set("key", value).
The largest change is in phalcon/Mvc/Model.zep, where the setup() method sets ~15 ORM keys via globals_set() and ~36 read sites use globals_get() throughout the class.
Files to Change
| File |
globals_get |
globals_set |
phalcon/Db/Adapter/AbstractAdapter.zep |
0 |
2 |
phalcon/Mvc/Model/Behavior/SoftDelete.zep |
1 |
0 |
phalcon/Mvc/Model/Manager.zep |
2 |
0 |
phalcon/Mvc/Model/MetaData/Stream.zep |
1 |
0 |
phalcon/Mvc/Model/Query/Builder.zep |
1 |
0 |
phalcon/Mvc/Model/Resultset/Complex.zep |
1 |
0 |
phalcon/Mvc/Model/Resultset/Simple.zep |
1 |
0 |
phalcon/Mvc/Model/Resultset.zep |
1 |
0 |
phalcon/Mvc/Model.zep |
~36 |
15 |
| Total |
~44 |
17 |
Excluded Files
The following files use globals_get("warning.enable", ...) which is a transient error flag (not a Settings key) and should remain unchanged:
phalcon/Annotations/Adapter/Stream.zep
phalcon/Storage/Adapter/Stream.zep
phalcon/Storage/Serializer/Igbinary.zep
phalcon/Storage/Serializer/Php.zep
phalcon/Support/Settings.zep (the globals_get calls here are the implementation itself)
Summary
All calls to
globals_get()andglobals_set()for known ORM/DB settings keys should be replaced withSettings::get()andSettings::set()fromPhalcon\Support\Settings.Motivation
Settings::get()checks PHP-level overrides first, then falls back toglobals_get().Settings::set()stores values at the PHP level only and does not callglobals_set(). This prevents settings from one project leaking into another when they share the same PHP worker process.How This Will Be Fixed
Each of the 9 affected
.zepfiles will be updated as follows:use Phalcon\Support\Settings;to the file's imports.globals_get("key")call (for a known Settings key) withSettings::get("key").globals_set("key", value)call withSettings::set("key", value).The largest change is in
phalcon/Mvc/Model.zep, where thesetup()method sets ~15 ORM keys viaglobals_set()and ~36 read sites useglobals_get()throughout the class.Files to Change
globals_getglobals_setphalcon/Db/Adapter/AbstractAdapter.zepphalcon/Mvc/Model/Behavior/SoftDelete.zepphalcon/Mvc/Model/Manager.zepphalcon/Mvc/Model/MetaData/Stream.zepphalcon/Mvc/Model/Query/Builder.zepphalcon/Mvc/Model/Resultset/Complex.zepphalcon/Mvc/Model/Resultset/Simple.zepphalcon/Mvc/Model/Resultset.zepphalcon/Mvc/Model.zepExcluded Files
The following files use
globals_get("warning.enable", ...)which is a transient error flag (not a Settings key) and should remain unchanged:phalcon/Annotations/Adapter/Stream.zepphalcon/Storage/Adapter/Stream.zepphalcon/Storage/Serializer/Igbinary.zepphalcon/Storage/Serializer/Php.zepphalcon/Support/Settings.zep(theglobals_getcalls here are the implementation itself)