Fixed XF web upgrade exposes half-upgraded state to addons due to composer class-map

Xon

Well-known member
Affected version
2.3.0 Beta 2
When upgrading from XF2.x => XF2.3, a new composer class map is deployed while the XF2.x application state is loaded in the "Verifying and copying files" step.

@TMC reported this error, where the class-map pointed to a file which doesn't exist yet:
Code:
Fatal error: Uncaught ErrorException: [E_WARNING] include(/var/www/[redacted]/public/src/vendor/composer/../../../src/vendor-patch/Doctrine/Common/Cache/CacheProvider.php): Failed to open stream: No such file or directory

Since the caching backend can be custom (and might be changed in non-backwards compatible ways anyway), it probably would make sense for the web installer to disable any caching backends.
 
Just to make sure that this affects only the 2.3.0 beta upgrade, I just installed clean 2.2.13.
After that installed Xon's redis cache addon and enabled it in the config.

Upgrading from 2.2.13 to 2.2.15 worked fine, but upgrade from 2.2.15 to 2.3.0 beta 2 crashed with error "An unexpected error occurred. Please try again later." after the "Upgrading... Verifying and copying files" step.

Trying to access the site gives the error mentioned on above Xon's post. Below is the error after enabling xdebug:
Code:
( ! ) Fatal error: Uncaught ErrorException: [E_WARNING] include(/var/www/[redacted]/public/src/vendor/composer/../../../src/vendor-patch/Doctrine/Common/Cache/CacheProvider.php): Failed to open stream: No such file or directory in /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php on line 576
( ! ) ErrorException: [E_WARNING] include(/var/www/[redacted]/public/src/vendor/composer/../../../src/vendor-patch/Doctrine/Common/Cache/CacheProvider.php): Failed to open stream: No such file or directory in /var/www/[redacted]/public/src/vendor/composer/ClassLoader.php on line 576
Call Stack
#    Time    Memory    Function    Location
1    0.0026    871176    XF::handleException()    .../XF.php:0
2    0.0026    871176    XF\Pub\App->logException()    .../XF.php:202
3    0.0026    871288    XF\Error->logException()    .../App.php:2498
4    0.0034    878416    XF\Util\File::installLockExists()    .../Error.php:102
5    0.0034    878416    XF::fs()    .../File.php:770
6    0.0034    878416    XF\Pub\App->fs()    .../XF.php:944
7    0.0034    878416    XF\Container->offsetGet()    .../App.php:2736
8    0.0034    878416    XF\Pub\App->XF\{closure:/var/www/[redacted]/public/src/XF/App.php:1115-1120}()    .../Container.php:31
9    0.0034    878512    XF\Pub\App->extendClass()    .../App.php:1117
10    0.0034    878512    XF\Pub\App->extension()    .../App.php:3011
11    0.0034    878512    XF\Container->offsetGet()    .../App.php:2980
12    0.0034    878512    XF\Pub\App->XF\{closure:/var/www/[redacted]/public/src/XF/App.php:1586-1607}()    .../Container.php:31
13    0.0034    878608    XF\Container->offsetGet()    .../App.php:1597
14    0.0034    878608    XF\Pub\App->XF\{closure:/var/www/[redacted]/public/src/XF/App.php:1929-1939}()    .../Container.php:31
15    0.0034    878704    XF\Container->offsetGet()    .../App.php:1931
16    0.0034    878704    XF\Pub\App->XF\{closure:/var/www/[redacted]/public/src/XF/App.php:734-737}()    .../Container.php:31
17    0.0035    878928    XF\Pub\App->cache()    .../App.php:736
18    0.0035    878928    XF\Container->create()    .../App.php:2661
19    0.0035    878928    XF\Pub\App->XF\{closure:/var/www/[redacted]/public/src/XF/App.php:673-710}()    .../Container.php:234
20    0.0035    879024    XF\CacheFactory->create()    .../App.php:709
21    0.0035    879024    XF\CacheFactory->instantiate()    .../CacheFactory.php:36
22    0.0035    879288    Composer\Autoload\ClassLoader->loadClass()    .../CacheFactory.php:68
23    0.0035    879416    Composer\Autoload\{closure:/var/www/[redacted]/public/src/vendor/composer/ClassLoader.php:575-577}()    .../ClassLoader.php:427
25    0.0035    879848    class_alias()    .../Redis.php:11
26    0.0035    879976    Composer\Autoload\ClassLoader->loadClass()    .../Redis.php:11
27    0.0035    880136    Composer\Autoload\{closure:/var/www/[redacted]/public/src/vendor/composer/ClassLoader.php:575-577}()    .../ClassLoader.php:427
29    0.0035    880536    Composer\Autoload\ClassLoader->loadClass()    .../Redis.php:26
30    0.0035    880696    Composer\Autoload\{closure:/var/www/[redacted]/public/src/vendor/composer/ClassLoader.php:575-577}()    .../ClassLoader.php:427
32    0.0035    881104    Composer\Autoload\ClassLoader->loadClass()    .../CacheProvider.php:19
33    0.0035    881104    Composer\Autoload\{closure:/var/www/[redacted]/public/src/vendor/composer/ClassLoader.php:575-577}()    .../ClassLoader.php:427
34    0.0035    881584    XF::handlePhpError()    .../ClassLoader.php:576

In order to access the site again, I have to disable redis cache settings in config.php.
After that I can access Admin CP, but it's still on version 2.2.15 as the upgrade didn't finish. File health check gives output "There are 624 missing files or files with unexpected contents. You should review these.".
Re-running the upgrade without redis settings being enabled works fine.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.0 Beta 3).

Change log:
Address a few autoload issues in the one-click upgrade process
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom