I noticed on my servers where PHP Error Reporting was turned from E_ALL & ~E_NOTICE where it will report all errors except notices, to E_ALL where it shows all errors regardless that I got an error:

Notice: Undefined variable: conf in /var/www/drupal/includes/common.inc on line 776

So I looked at line 776 and it was

$conf = variable_init($conf);

I also noticed on line 767 there was

unset($conf);

which means PHP is going to complain if you try to pass it as a param I just changed line 776 to

$conf = variable_init();

since an empty array is set by function when called with no param and all is well. I dont know if this is a repeat bug but I searched and couldn't find and bug report on it.

AZTEK

Comments

ax’s picture

Title: PHP Errors » "Notice: Undefined variable: conf" in common.inc on line 779

same problem here: i have "error_reporting = E_ALL" in my php.ini (as suggested by php.ini-recommended: "These error messages are emitted for non-critical errors, but that could be a symptom of a bigger problem."), and this warning just fills up my error log, one line with every request.

is there a reason the variable_init($conf); gets called with the parameter $conf (which, being undefined, causes the warning), i mean, is it possible at all that $conf has some value before this call? cause if not, just change the call to variable_init(); as AZTEK suggests, and we are rid of the problem.

please someone look at this.

Anonymous’s picture

The current behaviour is correct.

$conf[] lets you override configuration options in the config file. This is handy if you run multiple sites off one database.

A proper fix would be to check if $conf is set before using it.

Anonymous’s picture

Applied Ax's patch so this is fixed.

ax’s picture

Priority: Major » Critical

you applied the patch at the wrong place: you changed
$config = conf_init(); (line 768)
instead of
$conf = variable_init($conf); (line 779)
result is that drupal dies with "PHP Fatal error: Call to undefined function: db_query() in includes/common.inc on line 146" ...

ax’s picture