Fixed ErrorException: [E_WARNING] count(): Parameter must be an array or an object that implements Countable

Neutral Singh

Well-known member
Affected version
2.0.4
On my test server, while upgrading from 1.5.17 to xf 2.0.4, got this message and the upgrade terminated...

ErrorException: [E_WARNING] count(): Parameter must be an array or an object that implements Countable in src/XF/Install/Upgrade/2000010-200a.php at line 1276

  1. XF::handlePhpError()
  2. count() in src/XF/Install/Upgrade/2000010-200a.php at line 1276
  3. XF\Install\Upgrade\Version2000010->step26() in src/XF/Install/Controller/Upgrade.php at line 169
  4. XF\Install\Controller\Upgrade->actionRun() in src/XF/Mvc/Dispatcher.php at line 249
  5. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
  6. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
  7. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1891
  8. XF\App->run() in src/XF.php at line 328
  9. XF::runApp() in install/index.php at line 14
 
Last edited:
In the file src/XF/Install/Upgrade/2000010-200a.php you will find this line:
PHP:
$permissionCache = @unserialize($admin['permission_cache']);
I believe all that's required is to change it to:
PHP:
$permissionCache = @unserialize($admin['permission_cache']) ?: [];
And then hit refresh and the process should continue.
 
Top Bottom