Hotfix Patcher 4.8.10: PHP7.4 = syntax error, unexpected '|', expecting ';' or '

Started by Blondini, Today at 00:33:32 AM

Previous topic - Next topic

Blondini

Appears the hotfix patcher and update package to 4.8.10 is not compatible with PHP7.4.  The documentation still says VirtueMart has a minimum PHP of 5.3.10.

I installed this on a small low traffic site first and was immediately inaccessible.  The access_log recorded a 500 error but no entry in error_log or the PHP error log.  I restored, enabled Joomla (3.10.12) debug and got the following:

===
syntax error, unexpected '|', expecting ';' or '{'

Call stack      
#   Function   Location
1   ()   JROOT/administrator/components/com_virtuemart/helpers/vrequest.php:150
2   VirtueMart\Composer\Autoload\includeFile()   JROOT/administrator/components/com_virtuemart/vendor/composer/ClassLoader.php:334
3   VirtueMart\Composer\Autoload\ClassLoader->loadClass()   
4   spl_autoload_call()   JROOT/administrator/components/com_virtuemart/helpers/vmlanguage.php:75
5   vmLanguage::initialise()   JROOT/administrator/components/com_virtuemart/helpers/config.php:484
6   VmConfig::loadConfig()   JROOT/plugins/system/vponepagecheckout/cart/helper.php:69
7   VPOPCHelper->__construct()   JROOT/plugins/system/vponepagecheckout/cart/helper.php:105
8   VPOPCHelper::getInstance()   JROOT/plugins/system/vponepagecheckout/vponepagecheckout.php:69
9   PlgSystemVPOnePageCheckout->onAfterRoute()   JROOT/libraries/joomla/event/event.php:70
10   JEvent->update()   JROOT/libraries/joomla/event/dispatcher.php:160
11   JEventDispatcher->trigger()   JROOT/libraries/src/Application/BaseApplication.php:108
12   Joomla\CMS\Application\BaseApplication->triggerEvent()   JROOT/libraries/src/Application/CMSApplication.php:1190
13   Joomla\CMS\Application\CMSApplication->route()   JROOT/libraries/src/Application/SiteApplication.php:796
14   Joomla\CMS\Application\SiteApplication->route()   JROOT/libraries/src/Application/SiteApplication.php:218
15   Joomla\CMS\Application\SiteApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:225
16   Joomla\CMS\Application\CMSApplication->execute()
===

I asked ChatGPT and came back with it requiring PHP8 minimum and in /administrator/components/com_virtuemart/helpers/vrequest.php suggested changing:
public static function filterCmd(mixed $name): string|false {with
public static function filterCmd($name) {Once saved it worked a treat.

Short term can you confirm this is the only change in the hotfix requiring full PHP7.4 compatibility and when the update package is safe to install.

I also just checked the hotfix in MySite.guru's brand new Preflight tool which confirms the same plus suggests admin/files/paypal_checkout/helpers/response.php has a union type compatibility issue with:
static function captureOrderByOrderId(object $plugin, int|string|null &$render): void {
Many thanks.

Blondini

Sorry was also being applied to VirtueMart 4.6.4 11226 so used the hotfix "if your VM version is at least VM4.6".

I note MySite.guru's Preflight tool claims the alternative "if your VM version is lower than VM4.6" is compatible with PHP7.1.

Is PHP7 compatibility the only difference between the two?