Skip to content

phpvirtualbox is not working when php 8.0.3 and higher is used #264

Closed

Description

@Dutchman01

phpvirtualbox is not working when freebsd 12.2 and php 8.0 and higher is used!

"An unknown PHP error occurred. This is most likely a syntax error in config.php in phpVirtualBox's folder. The most common errors are an unclosed quote or a missing semicolon in a configuration item that has been entered (e.g. location, username, or password)."
etc.

Please update internal code to support php 8 please

Activity

  1. stianvis commented on Jan 12, 2021

    @stianvis
    Contributor

    Works fine on CentOS 8.3.2011 and PHP 8.0.1. You have the required packages installed? Web server and PHP installation

  2. Dutchman01 commented on Jan 13, 2021

    @Dutchman01
    Author

    FreeBSD 13.0 P5 phpvirtualbox and PHP Version 8.0.13 is not working for me.
    virtualbox 6.1.28

    "An unknown PHP error occurred. This is most likely a syntax error in config.php in phpVirtualBox's folder. The most common errors are an unclosed quote or a missing semicolon in a configuration item that has been entered (e.g. location, username, or password)."

    updated to strip long phpinfo

  3. stianvis commented on Jan 15, 2021

    @stianvis
    Contributor

    What are your virtualbox and phpvirtualbox versions?

  4. stianvis commented on Jan 17, 2021

    @stianvis
    Contributor

    Not sure what's wrong. I'm not that familiar with FreeBSD but I installed this
    virtualbox-ose-nox11 apache24 mod_php80 php80 php80-simplexml php80-soap php80-xml php80-session
    and
    https://github.com/phpvirtualbox/phpvirtualbox/archive/5.2-1.zip
    on a fresh FreeBSD 12.2 install and it seems to be working.

  5. Dutchman01 commented on Nov 23, 2021

    @Dutchman01
    Author

    What i have found on my setup to make it work!

    When i go to /phpvirtualbox/endpoints/lib
    edit language.php
    in line 62 and so on

    	// No lang file found
    	} else {
    		$lang = 'en';
    		@define('VBOXLANG', $lang);
    		self::$langdata['contexts'] = array();
    		return;
    	}
    

    after this , I added manual
    $lang = "nl";

    so, whatever happened to $lang before, it is now set to "de"
    and login is possible again.

    to me it proves there is a bug in getting proper en language and popup a working error free login screen.

    workaround 2:
    I copyd all from nl.xml and past in into en.xml in phpvirtualbox/languages and saved the file with en translated strings again.

    Now also the en login works again and i can login to phpvirtualbox.

    and the message disappear
    "An unknown PHP error occurred. This is most likely a syntax error in config.php in phpVirtualBox's folder. The most common errors are an unclosed quote or a missing semicolon in a configuration item that has been entered (e.g. location, username, or password)."

  6. changed the title [-]phpvirtualbox is not working when php 8.0 and higher is used[/-] [+]phpvirtualbox is not working when php 8.0.3 and higher is used[/+] on Nov 23, 2021
  7. ms49434 commented on Nov 23, 2021

    @ms49434

    In endpoints/lib/language.php line 77/78, the issue is that $arrXml is an empty array when english language is selected and therefore doesn't contain key 'context':

    72
    73 $xmlObj = simplexml_load_string(@file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml'));
    74 $arrXml = $this->objectsIntoArray($xmlObj);
    75
    76 $lang = array();
    77 if(!@$arrXml['context'][0]) $arrXml['context'] = array($arrXml['context']);
    78 foreach($arrXml['context'] as $c) {

    The fix is simple:

    72
    73 $xmlObj = simplexml_load_string(@file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml'));
    74 $arrXml = $this->objectsIntoArray($xmlObj);
    75-
    75+ if(!array_key_exists('context',$arrXml)) return;
    76 $lang = array();
    77 if(!@$arrXml['context'][0]) $arrXml['context'] = array($arrXml['context']);
    78 foreach($arrXml['context'] as $c) {

    This works with PHP 7 as well.

    PR #292 has been created, containing the above code change.

  8. Dutchman01 commented on Nov 27, 2021

    @Dutchman01
    Author

    issue closed see #292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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