Database error on create - PHP 8 - Multiserver

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

  1. Ator

    Ator New Member

    Hi,
    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.

    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('127.0.0.1', NULL)

    I think the error comes from PHP 8:
    https://www.php.net/manual/en/function.explode.php
    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: adm.domain.com
    - Host server: web.domain.com
    - Database server: mariadb.domain.com

    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
    https://git.ispconfig.org/ispconfig/ispconfig3/-/blob/develop/interface/web/sites/database_edit.php

    Can you help me?
    Thanks for the help!

    Regards,
    Sebas

    --------------------------------------------------------------------------------------------------

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

    EDIT 2 - NOT RECOMMENDED FIX
    I just commented the line #462 to create the database. Database is created now. I will test it.

    EDIT 3 FINAL - DATABASE IS WORKING
    Tested. But it is not a recommended fix at all. Worked with my configuration.

    --------------------------------------------------------------------------------------------------

    ERROR LOG
    [Fri Jan 13 11:29:45.008413 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] 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: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008462 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: Stack trace:, referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008467 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #0 /usr/local/ispconfig/interface/web/sites/database_edit.php(462): in_array('127.0.0.1', NULL), referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008470 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #1 /usr/local/ispconfig/interface/lib/classes/tform_actions.inc.php(200): page_action->onBeforeInsert(), referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008473 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #2 /usr/local/ispconfig/interface/lib/classes/tform_actions.inc.php(98): tform_actions->onInsert(), referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008476 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #3 /usr/local/ispconfig/interface/web/sites/database_edit.php(295): tform_actions->onSubmit(), referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008479 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #4 /usr/local/ispconfig/interface/lib/classes/tform_actions.inc.php(69): page_action->onSubmit(), referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008482 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #5 /usr/local/ispconfig/interface/web/sites/database_edit.php(543): tform_actions->onLoad(), referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008485 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: #6 {main}, referer: https://adm.domain.com:8080/index.php
    [Fri Jan 13 11:29:45.008487 2023] [fcgid:warn] [pid 1414] [client xxx.xxx.xxx.xxx:50293] mod_fcgid: stderr: thrown in /usr/local/ispconfig/interface/web/sites/database_edit.php on line 462, referer: https://adm.domain.com:8080/index.php
     

    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.

    https://git.ispconfig.org/ispconfig/ispconfig3/-/blob/develop/interface/web/sites/database_edit.php

    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