On site http://fantasy-portal.ru , I have this error if request not presents pages with "/blog/" in path (http://fantasy-portal.ru/blog/lalalalala for example)

If i request not present pages on all other pages and paths, i have normal "404 not found" answer (http://fantasy-portal.ru/lalalalala for example)

Comments

berdir’s picture

This means that something calls l() wrong, the second argument is not an array. And I assume it is a contrib module, because I can't reproduce it.

You need to figure out who is the caller. Open that file, go to that line (or look for "function l($text, $path, $options = array()) {")) and then insert "array " before $options so that it looks like "function l($text, $path, array $options = array()) {".

Then access the above link again, that should give you a different error message. Post that here.

Mascher’s picture

I insert "array" how u write, but i have some error message...
Fatal error: Unsupported operand types in /var/www/fantasy-portal.ru/htdocs/includes/common.inc on line 1592

But... I have error in logs:
Argument 3 passed to l() must be an array, null given, called in /var/www/fantasy-portal.ru/htdocs/includes/menu.inc on line 1612 and defined in file /var/www/fantasy-portal.ru/htdocs/includes/common.inc on line 1585.

berdir’s picture

Ok, strange.

We just have to dig until we find where this is coming from.

So open common.inc again and add the following code (without < ?php / ? >) directly above the "// Merge in defaults.":

if (!is_array($options)) {
  debug_print_backtrace();
  exit();
}

and then print the output here...

heine’s picture

Category: bug » support
Priority: Critical » Normal
fax8’s picture

There are actually 2 lines containing "// Merge in defaults.". I guess that's the one in the l() function. I have it at line 1588.

fax8’s picture

I faced this error after upgrading one of my websites from d5 to d6 .. I had a custom block containing some PHP code which used the old d5 definition of l() while, after upgrading to d6, it's required to use the new d6 l() syntax.

In particular I had something like:

print l(theme_image('images/camera1-small.jpg'), 'images/camera1.jpg', null, null, null, null, true);

and I had to convert it to:

print l(theme_image('images/camera1-small.jpg'), 'images/camera1.jpg', array('html' => TRUE));

Hope this helps,

Fabio Varesano

RedTop’s picture

StatusFileSize
new310.52 KB

I' m getting the same error when trying to access the settings page of one of the menus. It is quite a large menu with lots of child items (max dept probably around 5 levels or so). I' m able to access the other menus' settings just fine.

I tried the backtrace and the output was incredibly large. I have attached it to this comment.

Smart suggestions, anyone? :)

[edit]
Some debugging I tried today:

- Tried debugging as described here: http://drupal.org/node/362799. Unfortunately the output didn't change so that didn't help.

- I also tried the hack here: http://justinhileman.info/articles/unsupported-operand-types-in-drupal-6x , didn't help either (output stays the same except obviously for line number). :(

- I also tried disabling contributed modules by renaming the folders. None of the contributed modules seem to be the cause of this problem.

- Compared common.inc with a clean copy I always keep as a backup (sometimes it's hard keeping track of things when debugging). No differences. Copied the clean copy to includes folder anyway but didn't make a difference.

- The site has no custom blocks using PHP snippets (In fact, no custom snippets used anywhere on the site).

- The backtrace output mentiones line 73 in menu.admin.inc:73 of the menu module:

 $form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');

[edit]
This fix did the trick for me:
http://drupal.org/node/228435#comment-782632

Mascher’s picture

Berdir I do as u say and i have this code in common.inc:

function l($text, $path, array $options = array()) {
  global $language;

if (!is_array($options)) {
  debug_print_backtrace();
  exit();
}
  // Merge in defaults.
  $options += array(
      'attributes' => array(),
      'html' => FALSE,
    );

  // Append active class.
  if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) &&
      (empty($options['language']) || $options['language']->language == $language->language)) {
    if (isset($options['attributes']['class'])) {
      $options['attributes']['class'] .= ' active';
    }
    else {
      $options['attributes']['class'] = 'active';
    }
  }

  // Remove all HTML and PHP tags from a tooltip. For best performance, we act only
  // if a quick strpos() pre-check gave a suspicion (because strip_tags() is expensive).
  if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
    $options['attributes']['title'] = strip_tags($options['attributes']['title']);
  }

  return '<a href="'. check_url(url($path, $options)) .'"'. drupal_attributes($options['attributes']) .'>'. ($options['html'] ? $text : check_plain($text)) .'</a>';
}

And i have this output:

#0  l(, , ) called at [/var/www/fantasy-portal.ru/htdocs/includes/menu.inc:1612]
#1  menu_get_active_breadcrumb() called at [/var/www/fantasy-portal.ru/htdocs/includes/common.inc:100]
#2  drupal_get_breadcrumb() called at [/var/www/fantasy-portal.ru/htdocs/includes/theme.inc:1856]
#3  template_preprocess_page(Array ([template_files] => Array (),[content] =>{MY 404 page content part},[show_blocks] => ,[show_messages] => 1,[zebra] => odd,[id] => 1,[directory] => sites/all/themes/fantasyportal,[is_admin] => 1,[is_front] => ,[logged_in] => 1,[db_is_active] => 1,[user] => stdClass Object ([uid] => 1,[name] => Mascher,[pass] => 60318d649ceb2bccb40d3e5472adb997,[mail] => fantasy_portal@mail.ru,[mode] => 2,[sort] => 1,[threshold] => 0,[theme] => ,[signature] => ,[created] => 1225875541,[access] => 1269933321,[login] => 1269867964,[status] => 1,[timezone] => 21600,[language] => ru,[picture] => sites/default/files/pictures/avatars/picture-1.jpg,[init] => fantasy_portal@mail.ru,[data] => a:9:{s:14:"picture_delete";i:0;s:14:"picture_upload";s:0:"";s:13:"form_build_id";s:37:"form-dd75a789071eeda3b35806fa94ac2a90";s:17:"comments_per_page";s:2:"50";s:5:"block";a:3:{s:6:"search";a:1:{i:0;i:1;}s:7:"archive";a:1:{i:0;i:1;}s:5:"block";a:1:{i:13;i:1;}}s:18:"admin_compact_mode";b:1;s:9:"nodewords";a:6:{s:8:"abstract";s:0:"";s:6:"robots";s:0:"";s:11:"description";s:0:"";s:8:"keywords";s:0:"";s:9:"copyright";s:0:"";s:6:"geourl";s:0:"";}s:34:"user_relationship_mailer_send_mail";i:1;s:7:"contact";i:0;},[signature_format] => 1,[sid] => f752c2a23528c52a2f258646aed0b6d2,[hostname] => 212.73.124.9,[timestamp] => 1269933326,[cache] => 0,[session] => updates_remaining|a:0:{}user_overview_filter|a:0:{}dblog_overview_filter|a:0:{},[picture_delete] => 0,[picture_upload] => ,[form_build_id] => form-dd75a789071eeda3b35806fa94ac2a90,[comments_per_page] => 50,[block] => Array ([search] => Array ([0] => 1),[archive] => Array ([0] => 1),[block] => Array ([13] => 1)),[admin_compact_mode] => 1,[nodewords] => Array ([abstract] => ,[robots] => ,[description] => ,[keywords] => ,[copyright] => ,[geourl] => ),[user_relationship_mailer_send_mail] => 1,[contact] => 0,[roles] => Array ([2] => authenticated user,[3] => Администратор)),[header_left] => ,[header_center] => ,[header_right] => {MY 404 page content part} ,[topmenu] => {MY 404 page content part}, ,[left] => ,[right] => ,[content_top_left] => ,[content_top_right] => ,[content_bottom_left] => ,[content_bottom_right] => ,[footer_left] => ,[footer_center] => {MY 404 page content part},[footer_right] => ,[layout] => none,[head_title] => Фэнтези Портал | Героическое наследие фэнтези,[base_path] => /,[front_page] => /), page) 
#4 call_user_func_array(template_preprocess_page, Array ([0] => Array ([template_files] => Array (),[content] => {MY 404 page content part},[show_blocks] => ,[show_messages] => 1,[zebra] => odd,[id] => 1,[directory] => sites/all/themes/fantasyportal,[is_admin] => 1,[is_front] => ,[logged_in] => 1,[db_is_active] => 1,[user] => stdClass Object ([uid] => 1,[name] => Mascher,[pass] => 60318d649ceb2bccb40d3e5472adb997,[mail] => fantasy_portal@mail.ru,[mode] => 2,[sort] => 1,[threshold] => 0,[theme] => ,[signature] => ,[created] => 1225875541,[access] => 1269933321,[login] => 1269867964,[status] => 1,[timezone] => 21600,[language] => ru,[picture] => sites/default/files/pictures/avatars/picture-1.jpg,[init] => fantasy_portal@mail.ru,[data] => a:9:{s:14:"picture_delete";i:0;s:14:"picture_upload";s:0:"";s:13:"form_build_id";s:37:"form-dd75a789071eeda3b35806fa94ac2a90";s:17:"comments_per_page";s:2:"50";s:5:"block";a:3:{s:6:"search";a:1:{i:0;i:1;}s:7:"archive";a:1:{i:0;i:1;}s:5:"block";a:1:{i:13;i:1;}}s:18:"admin_compact_mode";b:1;s:9:"nodewords";a:6:{s:8:"abstract";s:0:"";s:6:"robots";s:0:"";s:11:"description";s:0:"";s:8:"keywords";s:0:"";s:9:"copyright";s:0:"";s:6:"geourl";s:0:"";}s:34:"user_relationship_mailer_send_mail";i:1;s:7:"contact";i:0;},[signature_format] => 1,[sid] => f752c2a23528c52a2f258646aed0b6d2,[hostname] => 212.73.124.9,[timestamp] => 1269933326,[cache] => 0,[session] => updates_remaining|a:0:{}user_overview_filter|a:0:{}dblog_overview_filter|a:0:{},[picture_delete] => 0,[picture_upload] => ,[form_build_id] => form-dd75a789071eeda3b35806fa94ac2a90,[comments_per_page] => 50,[block] => Array ([search] => Array ([0] => 1),[archive] => Array ([0] => 1),[block] => Array ([13] => 1)),[admin_compact_mode] => 1,[nodewords] => Array ([abstract] => ,[robots] => ,[description] => ,[keywords] => ,[copyright] => ,[geourl] => ),[user_relationship_mailer_send_mail] => 1,[contact] => 0,[roles] => Array ([2] => authenticated user,[3] => Администратор)),[header_left] => ,[header_center] => ,[header_right] => {MY 404 page content part},[topmenu] => {MY 404 page content part},[left] => ,[right] => ,[content_top_left] => ,[content_top_right] => ,[content_bottom_left] => ,[content_bottom_right] => ,[footer_left] => ,[footer_center] => {MY 404 page content part},[footer_right] => ,[layout] => none,[head_title] => Фэнтези Портал | Героическое наследие фэнтези,[base_path] => /,[front_page] => /),[1] => page)) called at [/var/www/fantasy-portal.ru/htdocs/includes/theme.inc:697] 
#5 theme(page, {MY 404 page content part}, ) called at [/var/www/fantasy-portal.ru/htdocs/includes/common.inc:391] 
#6 drupal_not_found() called at [/var/www/fantasy-portal.ru/htdocs/index.php:24] 

In log i have:

Argument 3 passed to l() must be an array, null given, called in /var/www/fantasy-portal.ru/htdocs/includes/menu.inc on line 1612 and defined в файле /var/www/fantasy-portal.ru/htdocs/includes/common.inc  в строке 1585.

You can see this at - http://fantasy-portal.ru/blog/amon/lalalalala , as sample.

And! This patch help me:
http://drupal.org/node/228435#comment-782632

but i restore Berdir writen code for test and patch if need.

deep-z’s picture

Maybe incorrect URL formation, caused by some module conflicting with core clean url's system.

Make sure you don't have Clean pagination module (6.x-1.0-alpha2 version in my case) enabled. Disabled it and error vanished.

Hope this helps.

Mascher’s picture

Berdir read this issue? I have patch now:

http://drupal.org/node/228435#comment-782632

If u need see debug tell me here...

Mascher’s picture

Assigned: Mascher » Unassigned

Unassign now...

golubovicm’s picture

Exactly same error happened to me, but fortunately it was in module I was working on, so I managed to localize it. Problem was that I by mistake named my functions like hooks, even they was not hooks.

My module name is "flash_uploader", and I named functions i.e. "flash_uploader_generate()".
So, I guess Drupal realized that this function is some mysterious hook_generate() hook and tried to do something with it and crushed there.

Just a wild guess - I'm still Drupal beginner.

pydubreucq’s picture

Hi all,
Excuse-me I'm French and I don't speak english very well...
I have the same problem.
This occur when I configure error page (403 & 404) in :
/admin/settings/error-reporting
If I don't put one I don't have this error...
Like on this page :
http://drupal.org/node/362799
I've modify common.inc to see what's the problem :

1585 function l($text, $path, $options = array()) {
1586   global $language;
1587   if (!is_array($options)) {
1588     echo "<pre>";
1589     $backtrace = debug_backtrace();
1590     var_export($backtrace[0]);
1591     die();
1592   }
1593   // Merge in defaults.
1594   $options += array(
1595       'attributes' => array(),
1596       'html' => FALSE,
1597     );

When I want to see my custom error page I can see now that :

array (
  'file' => '/var/www/dev-website-com/includes/menu.inc',
  'line' => 1612,
  'function' => 'l',
  'args' => 
  array (
    0 => NULL,
    1 => NULL,
    2 => NULL,
  ),
)

If I go on the line 1612 in menu.inc file I can see that :

1611     foreach ($active_trail as $parent) {
1612       $breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']);
1613     }

If I comment that, my 404 error page works fine :)

This is not the right solution, but it works
breadcrumb is a priority for me

Thanks by advance for your help ;)

Bye

pydubreucq’s picture

StatusFileSize
new467 bytes

This patch works fine :
http://drupal.org/node/228435#comment-782632

I've modify it because the line was not good...

You can find it on this comment.

Bye ;)

Ela’s picture

#14 works for me, Thank you :)

harvlad’s picture

Hey, this happened to me using the Me module

RedTop’s picture

Status: Active » Closed (fixed)

Multiple comments mention that this patch works and fixes the issue:
http://drupal.org/node/228435#comment-782632

pydubreucq modified the patch and included it in #14.

This thread is a duplicate and a fix is available. Now we just have to wait on the devvers in http://drupal.org/node/228435#comment-782632 to perfect it and commit to core.

Setting this as 'fixed' even though the fix available hasn't been perfected/committed yet. The patch works and a 'fixed' status will be more meaningful for people looking for a patch.

damien tournoud’s picture

Status: Closed (fixed) » Closed (works as designed)

There is nothing to fix here. Drupal Core works as designed, but something is calling the API in an incorrect way. Try to fix the really issue, not the symptom, please.

Ela’s picture

As in #7, I had this error when trying to access one of the menus. I deleted the menu, created it again, but gave it a different system name, and without the patch all seems fine.

gianfrasoft’s picture

Status: Closed (works as designed) » Needs review

Using the debug method explained in http://drupal.org/node/362799 I changed in menu.inc the rows:

    foreach ($active_trail as $parent) {
      $breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']);
    }

in

    foreach ($active_trail as $parent) {
      $breadcrumb[] = l($parent['title'], $parent['href'], array($parent['localized_options']));
    }

and problem seems to be solved. I think that is an invalid call of l() function, passing from the D5 sintax to the D6 one.

Status: Needs review » Needs work

The last submitted patch, common.patch, failed testing.

damien tournoud’s picture

Status: Needs work » Closed (works as designed)
SHS’s picture

#20 worked for me! thanks a lot :)

hchall’s picture

Thanks pydubreucq! #20 worked for me!

darrellduane’s picture

#20 was a big help -- This issue only happened when the user was anonymous, when logged in the error didn't happen.

-enzo-’s picture

Thanks pydubreucq! #20 worked for me! too

salientknight’s picture

Not sure what this adds to the conversation, but I just made a copy of a working site, and then started to get this error when logging in to the copy. All database and path settings are correct and they are on the same server... two other copies I made work fine.

*stumped*

salientknight’s picture

I needed to update my $cookie_domain variable in settings.php.

Michsk’s picture

I can also confim as stated in @#16 (http://drupal.org/node/739158#comment-3804798). This is happening with the ME module (offcourse multiple modules can have this, but ME is confirmed that it has this issue). Will look at it.

Those who also have this with the me module: http://drupal.org/node/899508#comment-5122266

David_Rothstein’s picture

Note that for the case where this kind of error occurs on custom 403 and 404 pages (as described in #13 above), this is likely due to #918356: WSOD when drupal_get_title called during hook_init and custom 403 or 404 pages are being used.

mattcasey’s picture

#20 works for me, I am using Acquia's latest Drupal 6.x version and got the error for 404 pages.

amstel’s picture

#20 also worked for me. I had this error message when trying to access admin pages after session expired.

chinita7’s picture

#20 worked for me also. Thanks.

carsonblack’s picture

Version: 6.16 » 6.28

This is still broken in 6.28
#20 works

carsonblack’s picture

StatusFileSize
new511 bytes

Here is a patch implementing #20.

carsonblack’s picture

Category: support » bug
Status: Closed (works as designed) » Needs review
codenamerhubarb’s picture

Issue summary: View changes

Thanks gianfrasoft
#20 also worked for me!

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.