Skip to content

getdir() problems in jqueryFileTree.php #273

@speters

Description

@speters

While trying out phpvirtualbox on a server running PHP 8.0.3, I ran into problems with the file selection dialog when trying to attach an ISO file.

image

This was due to the following error which showed up in the error logs:

PHP Fatal error:  Cannot redeclare getdir() in /usr/share/webapps/phpvirtualbox/endpoints/jqueryFileTree.php on line 224

getdir() seems to be a built-in function in PHP, so I wonder how this worked before.

The easiest fix is to rename getdir() function to something else.

Then another error showed up:

PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in /usr/share/webapps/phpvirtualbox/endpoints/jqueryFileTree.php:256

For PHP versions >= 7.30 the fix is to use is_countable() instead of count().

With those fixes, directory selection is working now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions