Ensure WoltLab Suite's autoloader runs first
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 2 Mar 2022 10:27:34 +0000 (11:27 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 2 Mar 2022 10:31:41 +0000 (11:31 +0100)
commite6ed878def7f6d85b147cf433a6bffa8aea605ff
tree7f41fecfdd9186878e8854cc7b1eabda1afe90c6
parent82124adf7a53d5372c45088fa30c1c5bef230303
Ensure WoltLab Suite's autoloader runs first

While we already configured composer's autoloader with:

    "prepend-autoloader": false,

in composer.json, the laminas-zendframework-bridge registers an autoloader by
itself and prepends it.

This autoloader will not match anything more often than not and certainly
nothing that can be loaded by WoltLab Suite's autoloader, thus needlessly
burning CPU cycles.

Fix this by:

1. Explicitly prepending WoltLab Suite's autoloader in the call to
   `spl_register_autoload()`.
2. Loading composer's autoloader (and by extension the autoloader of the
   bridge) before loading core.functions.php which will load WoltLab Suite's
   autoloader.
wcfsetup/install/files/lib/core.functions.php
wcfsetup/install/files/lib/system/WCF.class.php