[ postfixadmin-Bugs-3539027 ] Cannot redeclare maildir_name_hook()
Brought to you by:
christian_boltz,
gingerdog
From: SourceForge.net <no...@so...> - 2012-06-30 11:10:57
|
Bugs item #3539027, was opened at 2012-06-29 10:08 Message generated for change (Comment added) made by christian_boltz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=937964&aid=3539027&group_id=191583 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: v2.3.5 >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Martijn (mindcontrolled) Assigned to: Nobody/Anonymous (nobody) Summary: Cannot redeclare maildir_name_hook() Initial Comment: 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. ---------------------------------------------------------------------- >Comment By: Christian Boltz (christian_boltz) Date: 2012-06-30 04:10 Message: Well, actually config.inc.php is already require_once()'d via common.php, so the inclusion via setup.php is basically superfluous - but I'll keep it nevertheless (but only once) ;-) Thanks for finding the cause of this issue. I fixed it in SVN r 1405 (2.3 branch). SVN trunk seems to be fixed already. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=937964&aid=3539027&group_id=191583 |