Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • I ISPConfig 3
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 581
    • Issues 581
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 47
    • Merge requests 47
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISPConfig
  • ISPConfig 3
  • Issues
  • #6379
Closed
Open
Issue created Aug 25, 2022 by Jens@JensContributor

PHP8: count(): Argument #1 ($value) must be of type Countable|array, bool given

Summary

With PHP 8.1, the above error prevents ISPconfig from loading. With PHP 7.4, this error does not occur.

Steps to reproduce

  • Setup an Ubuntu 22.04 minimal VM image and ssh into it
  • cd /tmp
  • git clone https://git.ispconfig.org/ispconfig/ispconfig-autoinstaller.git
  • cd ispconfig-autoinstaller
  • git checkout ubuntu-22 # for php8 support which ubuntu20.04 doesn't have yet
  • ./ispc3-ai.sh --channel=dev --use-ftp-ports=40110-40210 --unattended-upgrades=autoclean,reboot
  • reboot the VM

Then test ISPconfig. The header appears, but nothing else. In the apache error log, this error is shown:

mod_fcgid: stderr: PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /usr/local/ispconfig/interface/lib/classes/tpl.inc.php(1366) : eval()'d code:116
mod_fcgid: stderr: Stack trace:
mod_fcgid: stderr: #0 /usr/local/ispconfig/interface/lib/classes/tpl.inc.php(1366): eval()
mod_fcgid: stderr: #1 /usr/local/ispconfig/interface/lib/classes/tpl.inc.php(769): tpl->_parse()
mod_fcgid: stderr: #2 /usr/local/ispconfig/interface/web/index.php(117): tpl->pparse()
mod_fcgid: stderr: #3 {main}
mod_fcgid: stderr:   thrown in /usr/local/ispconfig/interface/lib/classes/tpl.inc.php(1366) : eval()'d code on line 116

Using debug output, I could narrow it down to either <?php for ($_0=0 ; $_0 < count($this->_arrvars['datalog_changes']); $_0++) {?> or <?php for ($_0=0 ; $_0 < count($this->_arrvars['js_d_includes']); $_0++) {?> not being countable in /usr/local/ispconfig/interface/web/themes/default/templates/main.tpl.htm

Correct behaviour

ISPconfig should load. If I do this before starting the autoinstaller, ISPconfig loads correctly.

sed -i -e '/8.1/s/8\.1/7\.4/g' lib/os/class.ISPConfigUbuntu2204OS.inc.php

Environment

See above.

References

This probably belongs into the php8 branch.

Edited Aug 25, 2022 by Jens
Assignee
Assign to
Time tracking