BartekSz95 / phpvirtualbox

A web interface to manage and access Virtualbox machines.
Other
55 stars 15 forks source link

Error 500 in Linux Gentoo #7

Closed vsc55 closed 11 months ago

vsc55 commented 1 year ago

The following error is displayed when trying to load the page:

readyState: "4"
responseText: ""
status: "500"
statusText: "Internal Server Error"

Log Apache:

PHP Fatal error:  
Uncaught TypeError: Return value of VBox_Collection::current() must be an instance of mixed, instance of IGuestOSType returned in /home/www/store/virtualbox/phpvirtualbox/endpoints/lib/vboxServiceWrappers.php:156
Stack trace:
#0 /home/www/store/virtualbox/phpvirtualbox/endpoints/lib/vboxServiceWrappers.php(172): VBox_Collection->current()
#1 /home/www/store/virtualbox/phpvirtualbox/endpoints/lib/vboxconnector.php(3170): VBox_Collection->valid()
#2 /home/www/store/virtualbox/phpvirtualbox/endpoints/lib/vboxconnector.php(952): vboxconnector->remote_vboxGetGuestOSTypes()
#3 /home/www/store/virtualbox/phpvirtualbox/endpoints/api.php(316): vboxconnector->__call()
#4 {main}

So far I've been running VirtualBox 6 and the initial project running without a problem. After upgrading to version 7 and this version of phpvirutalbox I see that the errors occur.

vsc55 commented 1 year ago

The problem is in /endpoints/lib/vboxServiceWrappers.php:154 , if we remove : mixed, the error no longer occurs.

/endpoints/lib/vboxServiceWrappers.php:154

public function current()
{
    return current($this->_objects);
}
BartekSz95 commented 1 year ago

You know that you are using unsupported PHP version? Without this flag, this isn't work on PHP 8.x. Please, update your PHP for the newest supported version (8.1 or 8.2).

Read my README.md on this repository, I wrote which version of PHP is needed.