Database error on create - PHP 8 - Multiserver

Discussion in 'Installation/Configuration' started by Ator, Jan 13, 2023.

  1. Ator

    Ator New Member

    I'm having an error while trying to create an additional database for a user.
    I have a multiserver setup with 3 servers (ispconfig panel, web, db) with Centos 7.9.2009.
    All servers with ISPConfig 3.2.9

    I did the migration from PHP 7.4 to PHP 8.0 a few weeks ago.
    The system is working fine, I just needed an additional database for an existing user.
    All the configuration has 7 years old and I didn't touch any config values in ISPConfig/Settings before or after the upgrade.

    When I fill all the data to create the database, the save button is not saving because in the background it has an error.

    PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given
    /usr/local/ispconfig/interface/web/sites/database_edit.php(462): in_array('', NULL)

    I think the error comes from PHP 8:
    Changelog - Version Description
    8.0.0 explode() will now throw ValueError when separator parameter is given an empty string (""). Previously, explode() returned false instead.

    Tech Info
    - ISPConfig server:
    - Host server:
    - Database server:

    Possible Solution?
    Maybe filling the default_remote_dbserver information (attached image) can solve the issue. It seems the error is coming from that data.

    database_edit.php File

    Can you help me?
    Thanks for the help!



    EDIT 1
    I tried filling "default_remote_dbserver" but nothing changed. Same error.

    I just commented the line #462 to create the database. Database is created now. I will test it.

    Tested. But it is not a recommended fix at all. Worked with my configuration.


    [Fri Jan 13 11:29:45.008413 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /usr/local/ispconfig/interface/web/sites/database_edit.php:462, referer:
    [Fri Jan 13 11:29:45.008462 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: Stack trace:, referer:
    [Fri Jan 13 11:29:45.008467 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #0 /usr/local/ispconfig/interface/web/sites/database_edit.php(462): in_array('', NULL), referer:
    [Fri Jan 13 11:29:45.008470 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #1 /usr/local/ispconfig/interface/lib/classes/ page_action->onBeforeInsert(), referer:
    [Fri Jan 13 11:29:45.008473 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #2 /usr/local/ispconfig/interface/lib/classes/ tform_actions->onInsert(), referer:
    [Fri Jan 13 11:29:45.008476 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #3 /usr/local/ispconfig/interface/web/sites/database_edit.php(295): tform_actions->onSubmit(), referer:
    [Fri Jan 13 11:29:45.008479 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #4 /usr/local/ispconfig/interface/lib/classes/ page_action->onSubmit(), referer:
    [Fri Jan 13 11:29:45.008482 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #5 /usr/local/ispconfig/interface/web/sites/database_edit.php(543): tform_actions->onLoad(), referer:
    [Fri Jan 13 11:29:45.008485 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: #6 {main}, referer:
    [Fri Jan 13 11:29:45.008487 2023] [fcgid:warn] [pid 1414] [client] mod_fcgid: stderr: thrown in /usr/local/ispconfig/interface/web/sites/database_edit.php on line 462, referer:

    Attached Files:

    Last edited: Jan 13, 2023
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    if you've changed the system php you need to change it back. that'll most likely be the cause of your problems.
    ahrasis likes this.
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    And your file looks really like this one on the git system? There might have been changes made in the file in GIT, which is not in 3.2.9 and is due for 3.2.10. Because the second parameter should always be an array, as its either set to an empty array or to the return value of the explode command, which must be an array as well unless it tries to explode an empty variable, which is avoided by the first if the condition that prevents explode to run in this case.

    Try downloading it and replacing the one on your system.
    Last edited: Jan 14, 2023
    ahrasis likes this.
  4. Ator

    Ator New Member

    Last edited: Jan 14, 2023

Share This Page