@@ -85,8 +85,6 @@ final class Common
8585 public static function run (): void
8686 {
8787 $ GLOBALS ['containerBuilder ' ] = $ GLOBALS ['containerBuilder ' ] ?? null ;
88- $ GLOBALS ['errorHandler ' ] = $ GLOBALS ['errorHandler ' ] ?? null ;
89- $ GLOBALS ['config ' ] = $ GLOBALS ['config ' ] ?? null ;
9088 $ GLOBALS ['server ' ] = $ GLOBALS ['server ' ] ?? null ;
9189 $ GLOBALS ['lang ' ] = $ GLOBALS ['lang ' ] ?? null ;
9290 $ GLOBALS ['isConfigLoading ' ] = $ GLOBALS ['isConfigLoading ' ] ?? null ;
@@ -114,7 +112,9 @@ public static function run(): void
114112
115113 $ GLOBALS ['containerBuilder ' ] = Core::getContainerBuilder ();
116114
117- $ GLOBALS ['errorHandler ' ] = $ GLOBALS ['containerBuilder ' ]->get ('error_handler ' );
115+ /** @var ErrorHandler $errorHandler */
116+ $ errorHandler = $ GLOBALS ['containerBuilder ' ]->get ('error_handler ' );
117+ $ GLOBALS ['errorHandler ' ] = $ errorHandler ;
118118
119119 self ::checkRequiredPhpExtensions ();
120120 self ::configurePhpSettings ();
@@ -127,17 +127,15 @@ public static function run(): void
127127
128128 register_shutdown_function ([Config::class, 'fatalErrorHandler ' ]);
129129
130- /**
131- * Force reading of config file, because we removed sensitive values
132- * in the previous iteration.
133- */
134- $ GLOBALS ['config ' ] = $ GLOBALS ['containerBuilder ' ]->get ('config ' );
130+ /** @var Config $config */
131+ $ config = $ GLOBALS ['containerBuilder ' ]->get ('config ' );
132+ $ GLOBALS ['config ' ] = $ config ;
135133
136134 /**
137135 * include session handling after the globals, to prevent overwriting
138136 */
139137 if (! defined ('PMA_NO_SESSION ' )) {
140- Session::setUp ($ GLOBALS [ ' config ' ] , $ GLOBALS [ ' errorHandler ' ] );
138+ Session::setUp ($ config , $ errorHandler );
141139 }
142140
143141 $ request = Core::populateRequestWithEncryptedQueryParams ($ request );
@@ -154,7 +152,7 @@ public static function run(): void
154152 $ GLOBALS ['urlParams ' ] = [];
155153 $ GLOBALS ['containerBuilder ' ]->setParameter ('url_params ' , $ GLOBALS ['urlParams ' ]);
156154
157- self ::setGotoAndBackGlobals ($ GLOBALS ['containerBuilder ' ], $ GLOBALS [ ' config ' ] );
155+ self ::setGotoAndBackGlobals ($ GLOBALS ['containerBuilder ' ], $ config );
158156 self ::checkTokenRequestParam ();
159157 self ::setDatabaseAndTableFromRequest ($ GLOBALS ['containerBuilder ' ], $ request );
160158
@@ -189,27 +187,27 @@ public static function run(): void
189187 * check for errors occurred while loading configuration
190188 * this check is done here after loading language files to present errors in locale
191189 */
192- $ GLOBALS [ ' config ' ] ->checkPermissions ();
193- $ GLOBALS [ ' config ' ] ->checkErrors ();
190+ $ config ->checkPermissions ();
191+ $ config ->checkErrors ();
194192
195193 self ::checkServerConfiguration ();
196194 self ::checkRequest ();
197195
198196 /* setup servers LABEL_setup_servers */
199197
200- $ GLOBALS [ ' config ' ] ->checkServers ();
198+ $ config ->checkServers ();
201199
202200 /**
203201 * current server
204202 *
205203 * @global integer $server
206204 */
207- $ GLOBALS ['server ' ] = $ GLOBALS [ ' config ' ] ->selectServer ();
205+ $ GLOBALS ['server ' ] = $ config ->selectServer ();
208206 $ GLOBALS ['urlParams ' ]['server ' ] = $ GLOBALS ['server ' ];
209207 $ GLOBALS ['containerBuilder ' ]->setParameter ('server ' , $ GLOBALS ['server ' ]);
210208 $ GLOBALS ['containerBuilder ' ]->setParameter ('url_params ' , $ GLOBALS ['urlParams ' ]);
211209
212- $ GLOBALS ['cfg ' ] = $ GLOBALS [ ' config ' ] ->settings ;
210+ $ GLOBALS ['cfg ' ] = $ config ->settings ;
213211
214212 /* setup themes LABEL_theme_setup */
215213
@@ -218,7 +216,7 @@ public static function run(): void
218216 $ GLOBALS ['dbi ' ] = null ;
219217
220218 if (isset ($ GLOBALS ['isMinimumCommon ' ])) {
221- $ GLOBALS [ ' config ' ] ->loadUserPreferences ();
219+ $ config ->loadUserPreferences ();
222220 $ GLOBALS ['containerBuilder ' ]->set ('theme_manager ' , ThemeManager::getInstance ());
223221 Tracker::enable ();
224222
@@ -231,10 +229,8 @@ public static function run(): void
231229
232230 /**
233231 * save some settings in cookies
234- *
235- * @todo should be done in PhpMyAdmin\Config
236232 */
237- $ GLOBALS [ ' config ' ] ->setCookie ('pma_lang ' , (string ) $ GLOBALS ['lang ' ]);
233+ $ config ->setCookie ('pma_lang ' , (string ) $ GLOBALS ['lang ' ]);
238234
239235 ThemeManager::getInstance ()->setThemeCookie ();
240236
@@ -243,7 +239,7 @@ public static function run(): void
243239 $ GLOBALS ['containerBuilder ' ]->setAlias ('dbi ' , DatabaseInterface::class);
244240
245241 if (! empty ($ GLOBALS ['cfg ' ]['Server ' ])) {
246- $ GLOBALS [ ' config ' ] ->getLoginCookieValidityFromCache ($ GLOBALS ['server ' ]);
242+ $ config ->getLoginCookieValidityFromCache ($ GLOBALS ['server ' ]);
247243
248244 $ GLOBALS ['auth_plugin ' ] = Plugins::getAuthPlugin ();
249245 $ GLOBALS ['auth_plugin ' ]->authenticate ();
@@ -309,7 +305,7 @@ public static function run(): void
309305 $ GLOBALS ['containerBuilder ' ]->set ('response ' , ResponseRenderer::getInstance ());
310306
311307 // load user preferences
312- $ GLOBALS [ ' config ' ] ->loadUserPreferences ();
308+ $ config ->loadUserPreferences ();
313309
314310 $ GLOBALS ['containerBuilder ' ]->set ('theme_manager ' , ThemeManager::getInstance ());
315311
0 commit comments