This was reported earlier in #3305278 but closed because it could not be reproduced, but I just ran into this so here to see if we can get this solved forever ;-)
When this occured, I just downloaded the 2.3.5 tar.gz. Unpacked. Then began editting the config first, going through all the options one by one. I didn't use my previous config file which was from 2.3.3, and I didn't copy any other files over from that version. This 2.3.5 was a clean install.
Last thing I changed was maildir_name_hook. I uncommented the function, then attempted to run setup.php for generating a password hash. No error was displayed, but the page stopped rendering right after "Depends on: presence config.inc.php - OK". After the closing </li> there is an empty line in the source, it stops there.
In the logs I found a "PHP Fatal error: Cannot redeclare maildir_name_hook() (previously declared in /home/websites/www/postfixadmin/config.inc.php:172) in /home/websites/www/postfixadmin/config.inc.php on line 179".
Line 172: The line where function maildir_name_hook starts.
Line 179: The line where the function ends by means of a closing curly bracket.
If I uncomment the function completely, setup.php runs fine. Uncommenting it stops setup.php from running.
Looking at setup.php, line 123 and 126: The first one has a require_once() of the config, but the latter has a require() of the config. So in short, it seems that setup.php is loading config.inc.php twice, once by require_once() plus once by using require(), and the second time PHP will complain and halt on redeclaration of maildir_name_hook().
I'm not sure what the intention of this code is; on line 124 it sets $config_loaded = 1 and then it loads the config again. My initial response would be to remove the require() on line 126.
Log in to post a comment.