1010use wcf \data \page \Page ;
1111use wcf \system \application \ApplicationHandler ;
1212use wcf \system \application \IApplication ;
13- use wcf \system \benchmark \Benchmark ;
1413use wcf \system \box \BoxHandler ;
14+ use wcf \system \cache \builder \CoreObjectCacheBuilder ;
1515use wcf \system \cache \builder \PackageUpdateCacheBuilder ;
16- use wcf \system \cache \eager \CoreObjectCache ;
1716use wcf \system \database \MySQLDatabase ;
1817use wcf \system \event \EventHandler ;
1918use wcf \system \exception \ErrorException ;
2019use wcf \system \exception \IPrintableException ;
20+ use wcf \system \exception \ParentClassException ;
2121use wcf \system \exception \SystemException ;
2222use wcf \system \language \LanguageFactory ;
2323use wcf \system \package \command \RebuildBootstrapper ;
3131use wcf \system \template \EmailTemplateEngine ;
3232use wcf \system \template \TemplateEngine ;
3333use wcf \system \user \storage \UserStorageHandler ;
34- use wcf \system \user \UserProfileHandler ;
3534use wcf \util \DirectoryUtil ;
3635use wcf \util \FileUtil ;
3736use wcf \util \StringUtil ;
8079\mb_language ('uni ' );
8180
8281// define current woltlab suite version
83- \define ('WCF_VERSION ' , '6.2.0 dev 1 ' );
82+ \define ('WCF_VERSION ' , '6.1.11 ' );
8483
8584// define current unix timestamp
8685\define ('TIME_NOW ' , \time ());
9998 * @author Marcel Werk
10099 * @copyright 2001-2019 WoltLab GmbH
101100 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
102- *
103- * @method static Benchmark getBenchmark()
104- * @method static UserProfileHandler getUserProfileHandler()
105101 */
106102class WCF
107103{
@@ -125,7 +121,7 @@ class WCF
125121
126122 /**
127123 * list of autoload directories
128- * @var array<string, string>
124+ * @var array
129125 */
130126 protected static $ autoloadDirectories = [
131127 'wcf ' => WCF_DIR . 'lib/ ' ,
@@ -139,10 +135,9 @@ class WCF
139135
140136 /**
141137 * list of cached core objects
142- *
143- * @var array<string, class-string<SingletonFactory>>
138+ * @var string[]
144139 */
145- protected static array $ coreObjectCache ;
140+ protected static $ coreObjectCache = [] ;
146141
147142 /**
148143 * database object
@@ -180,7 +175,7 @@ class WCF
180175 */
181176 protected static $ zendOpcacheEnabled ;
182177
183- public const BOOTSTRAP_LOADER = \WCF_DIR . 'lib/bootstrap.php ' ;
178+ public const BOOTSTRAP_LOADER = \WCF_DIR . '/ lib/bootstrap.php ' ;
184179
185180 /**
186181 * Calls all init functions of the WCF class.
@@ -234,14 +229,11 @@ final protected function runBootstrappers(): void
234229 *
235230 * You *must* not create output in here under normal circumstances, as it might get eaten
236231 * when gzip is enabled.
237- *
238- * @return void
239232 */
240233 public static function destruct ()
241234 {
242235 try {
243236 // database has to be initialized
244- // @phpstan-ignore function.alreadyNarrowedType
245237 if (!\is_object (self ::$ dbObj )) {
246238 return ;
247239 }
@@ -261,7 +253,6 @@ public static function destruct()
261253 }
262254
263255 // update session
264- // @phpstan-ignore function.alreadyNarrowedType
265256 if (\is_object (self ::getSession ())) {
266257 self ::getSession ()->update ();
267258 }
@@ -327,7 +318,7 @@ final public static function getTPL()
327318 /**
328319 * Calls the show method on the given exception.
329320 */
330- final public static function handleException (\Throwable $ e ): never
321+ final public static function handleException (\Throwable $ e )
331322 {
332323 // backwards compatibility
333324 if ($ e instanceof IPrintableException) {
@@ -347,8 +338,6 @@ final public static function handleException(\Throwable $e): never
347338 @\header ('HTTP/1.1 500 Internal Server Error ' );
348339 try {
349340 \wcf \functions \exception \printThrowable ($ e );
350-
351- exit ;
352341 } catch (\Throwable $ e2 ) {
353342 echo "<pre>An Exception was thrown while handling an Exception: \n\n" ;
354343 echo \preg_replace ('/Database->__construct\(.*\)/ ' , 'Database->__construct(...) ' , $ e2 );
@@ -369,11 +358,11 @@ final public static function handleException(\Throwable $e): never
369358 * @param int $line
370359 * @throws ErrorException
371360 */
372- final public static function handleError ($ severity , $ message , $ file , $ line ): bool
361+ final public static function handleError ($ severity , $ message , $ file , $ line ): void
373362 {
374363 // this is necessary for the shut-up operator
375364 if (!(\error_reporting () & $ severity )) {
376- return true ;
365+ return ;
377366 }
378367
379368 throw new ErrorException ($ message , 0 , $ severity , $ file , $ line );
@@ -423,7 +412,6 @@ protected function loadOptions(): void
423412 if (!\is_writable ($ filename )) {
424413 FileUtil::makeWritable ($ filename );
425414
426- // @phpstan-ignore booleanNot.alwaysTrue
427415 if (!\is_writable ($ filename )) {
428416 throw new SystemException ("The option file ' " . $ filename . "' is not writable. " );
429417 }
@@ -512,9 +500,6 @@ protected function defineLegacyOptions(): void
512500
513501 // The option for the SFS action has been converted into a general option with version 6.1.
514502 \define ('BLACKLIST_SFS_ACTION ' , 'disable ' );
515-
516- // The option to show an article counter in the message sidebar was removed with version 6.2.
517- \define ('MESSAGE_SIDEBAR_ENABLE_ARTICLES ' , 0 );
518503 }
519504
520505 /**
@@ -654,7 +639,6 @@ protected function loadApplication(Application $application, bool $isDependentAp
654639 $ packageDir = FileUtil::getRealPath (WCF_DIR . $ relativePath );
655640 self ::$ autoloadDirectories [$ abbreviation ] = $ packageDir . 'lib/ ' ;
656641
657- // @phpstan-ignore if.alwaysFalse
658642 if (\class_exists ($ className )) {
659643 // the class can now be found, update the `packageDir` value
660644 (new PackageEditor ($ package ))->update (['packageDir ' => $ relativePath ]);
@@ -755,7 +739,7 @@ protected function initCoreObjects(): void
755739 return ;
756740 }
757741
758- self ::$ coreObjectCache = ( new CoreObjectCache ())-> getCache ();
742+ self ::$ coreObjectCache = CoreObjectCacheBuilder:: getInstance ()-> getData ();
759743 }
760744
761745 /**
@@ -841,7 +825,7 @@ final public static function setLanguage(int $languageID): void
841825 final public static function autoload (string $ className ): void
842826 {
843827 $ className = \strtr ($ className , '\\' , '/ ' );
844- if (($ slashPos = \strpos ($ className , '/ ' )) !== false ) {
828+ if (($ slashPos = \strpos ($ className , '/ ' )) !== null ) {
845829 $ applicationPrefix = \substr ($ className , 0 , $ slashPos );
846830 if (isset (self ::$ autoloadDirectories [$ applicationPrefix ])) {
847831 $ classPath = self ::$ autoloadDirectories [$ applicationPrefix ] . \substr ($ className , $ slashPos + 1 ) . '.class.php ' ;
@@ -865,7 +849,7 @@ final public static function autoloadDebug(string $className): void
865849 // logic cannot be moved into a shared function, because it
866850 // measurably reduced autoloader performance.
867851 $ className = \strtr ($ className , '\\' , '/ ' );
868- if (($ slashPos = \strpos ($ className , '/ ' )) !== false ) {
852+ if (($ slashPos = \strpos ($ className , '/ ' )) !== null ) {
869853 $ applicationPrefix = \substr ($ className , 0 , $ slashPos );
870854 if (isset (self ::$ autoloadDirectories [$ applicationPrefix ])) {
871855 $ classPath = self ::$ autoloadDirectories [$ applicationPrefix ] . \substr ($ className , $ slashPos + 1 ) . '.class.php ' ;
@@ -888,8 +872,7 @@ final public static function autoloadDebug(string $className): void
888872 }
889873
890874 /**
891- * @param mixed[] $arguments
892- * @return ?object
875+ * @inheritDoc
893876 */
894877 final public function __call (string $ name , array $ arguments )
895878 {
@@ -904,9 +887,9 @@ final public function __call(string $name, array $arguments)
904887 /**
905888 * Returns dynamically loaded core objects.
906889 *
907- * @param mixed[] $arguments
908- * @return ? object
909- * @throws SystemException
890+ * @param array $arguments
891+ * @return object
892+ * @throws SystemException
910893 */
911894 final public static function __callStatic (string $ name , array $ arguments )
912895 {
@@ -922,18 +905,20 @@ final public static function __callStatic(string $name, array $arguments)
922905 }
923906
924907 if (\class_exists ($ objectName )) {
908+ if (!\is_subclass_of ($ objectName , SingletonFactory::class)) {
909+ throw new ParentClassException ($ objectName , SingletonFactory::class);
910+ }
911+
925912 self ::$ coreObject [$ className ] = \call_user_func ([$ objectName , 'getInstance ' ]);
926913
927914 return self ::$ coreObject [$ className ];
928915 }
929-
930- return null ;
931916 }
932917
933918 /**
934919 * Searches for cached core object definition.
935920 *
936- * @return class- string<SingletonFactory> |null
921+ * @return string|null
937922 */
938923 final protected static function getCoreObject (string $ className )
939924 {
@@ -1002,7 +987,6 @@ public static function getActivePath(): string
1002987 }
1003988
1004989 /**
1005- * @param string $fragment
1006990 * @deprecated 5.5 - Put a '#' followed by the fragment as the anchor's href. Make sure to |rawurlencode any variables that may contain special characters.
1007991 */
1008992 public function getAnchor ($ fragment ): string
0 commit comments