Hi,
after I installed the piwik module (http://drupal.org/project/piwik), I get this error :
Fatal error: Unsupported operand types in /var/www/drupal/includes/common.inc on line 1416
When piwik is activated, I can't access my website due this error. If I deactivate piwik, I can access to the website.
The problem comes from this code:
function url($path = NULL, $options = array()) {
// Merge in defaults.
$options += array(
'fragment' => '',
'query' => '',
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''
);
When url() is called like this :
url($path, NULL);
Then $option is null and php can't do $options += array() cause it's like NULL+= array()
I search on the web and find here a possible solution : http://www.bekirdag.com/en/drupal/commoninc_fatal_error_problem_on_line_...
The solution was to change
$options += array(
'fragment' => '',
'query' => '',
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''
);
in
$options['fragment'] = "";
$options['query'] = "";
$options['absolute'] = FALSE;
$options['alias'] = FALSE;
$options['prefix'] = "";
but that's not the same cause with the concatenation when for example $option['fragment'] has already a value the value will be keep, and with the new code the value will change.
That produces bugs, for example, I can't run completely the script update.php. With this solution after the step "Select updates" I click on update and it goes to the first step, it make no update...
Maybe I have a solution but I'm sure if it's correct. I just suggest to add this code
if (!isset($options)) $options = array();
With the code there is no Fatal error anymore and I can make an update.
Maybe can someone tell me if my solution is ok or not.
Comments
Comment #1
nicks commentedsubcribing
(I have the same problem, possibly related to the flag module, and also decided that your approach is nicer than bekirdag's)
Comment #2
nicks commentedI believe this is a problem with modules, rather than with drupal core. There is a handbook page on this subject:
This error happens because the parameters to url() changed in Drupal 6. The most common problem is an enabled module hasn't fully converted it's code from Drupal 5 and is causing the error.
The page also describes how to debug the problem. The thread on fixing the flag module for this purpose may also be of use to people.
Comment #3
heine commentedMoving to the likely culprit.
Comment #4
hass commentedThere is no line in piwik that add's a NULL as second parameter to url(). Please point me to the line you are talking about. I cannot repro.
Comment #5
charles.bourasseau commentedI can't say that this error comes from Piwik, I didn't look at the code.
I just explained how this error was in my Drupal. How I got it.
Now I saw this error in many other website, and they not always spoke about Piwik, for me it's not just a module error but a code problem too.
Just with one line you can avoid that ... When a module can affect the core, for me it's a core fault.
Comment #6
heine commentedIf you install piwik and the error occurs, then uninstall piwik and the error stops, the error might very well be in piwik.
What exact module version are you using and which (sub)modules did you enable?
Comment #7
charles.bourasseau commentedI didn't remember, it was during an update from D5 to D6. It was so bad, Menu was in double, Piwik caused problem, and other problems. So we decided to restart a D6 from null, it's very better...
Now when I just see the core of D6:
function url($path = NULL, $options = array()) {
// Merge in defaults.
$options += array(
if url is called like that :
url($path, NULL);
Yes the problem comes from the module, but the problem can be avoid by the core...
Comment #8
heine commentedOkay, if it's not reproducible we cannot fix. As hass wrote, there's nothing on quick inspection that would cause this. Just like #225211: warning: preg_match() expects parameter 2 to be string - SRSLY, WON'T FIX, EVER., it won't be fixed in core either.
For those googling this error message: See Fatal error: Unsupported operand types in common.inc to find out how to debug this error.
Comment #9
hass commentedThis code is not inside the piwik D6 module! Won't fix for cannot repro.
Feel free to move the case somewhere else.
Comment #10
hass commented