Custom Breadcrumbs is working properly for Breadcrumb Type = node, but when I add a path type, I get an error. Here is how I am filling out the path fields:

Specific Path: 
   about/library-staff-directory/*
Titles: 
   About
   Library Staff Directory
Paths:
   about
   about/library-staff-directory

When I save this custom breadcrumb and visit any node edit page, I get this error:

Warning: Illegal offset type in isset or empty in drupal_lookup_path() (line 125 of /var/www/html/drupal/includes/path.inc). =>
... (Array, 12 elements)
Krumo version 0.2.1a | http://krumo.sourceforge.net Called from /var/www/html/drupal/includes/path.inc, line 125  
Warning: strtok() expects parameter 1 to be string, array given in strtok() (line 131 of /var/www/html/drupal/includes/path.inc). =>
... (Array, 13 elements)
Krumo version 0.2.1a | http://krumo.sourceforge.net  
Warning: mb_strtolower() expects parameter 1 to be string, array given in mb_strtolower() (line 476 of /var/www/html/drupal/includes/unicode.inc). =>
... (Array, 12 elements)
Krumo version 0.2.1a | http://krumo.sourceforge.net  

I've also attached a screenshot of the error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MGN’s picture

I've tried, but haven't been able to reproduce this.

somanyfish’s picture

I thought it must be a conflict with another module, so I went to reproduce the error and disable modules until it went away. I can no longer reproduce the error either. Sigh... Thanks for looking into this. If it happens again, I will attempt to gather more info immediately.

somanyfish’s picture

Ah, I figured it out. It's not on node edit, it's on node preview. Disabling Custom Breadcrumbs for paths fixes the error, enabling it causes it on any node preview page.

Ron Williams’s picture

This issue occurs on node edit as well. The error appears in the core admin theme with the overlay. This also caused issues when deleting files from affected nodes. I use the "Use wildcard pattern matching in paths " setting which may be causing the issue.

Ron Williams’s picture

I was able to resolve the issue with deleting files by excluding the module on node/*/edit pages; however, the error still occurs:

    Warning: Illegal offset type in isset or empty in drupal_lookup_path() (line 125 of /home/user/public_html/dev/includes/path.inc).
    Warning: strtok() expects parameter 1 to be string, array given in drupal_lookup_path() (line 131 of /home/user/public_html/dev/includes/path.inc).
    Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 476 of /home/user/public_html/dev/includes/unicode.inc).
    Warning: Illegal offset type in isset or empty in drupal_lookup_path() (line 125 of /home/user/public_html/dev/includes/path.inc).
    Warning: strtok() expects parameter 1 to be string, array given in drupal_lookup_path() (line 131 of /home/user/public_html/dev/includes/path.inc).
    Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 476 of /home/user/public_html/dev/includes/unicode.inc).
    Warning: Illegal offset type in isset or empty in drupal_lookup_path() (line 125 of /home/user/public_html/dev/includes/path.inc).
    Warning: strtok() expects parameter 1 to be string, array given in drupal_lookup_path() (line 131 of /home/user/public_html/dev/includes/path.inc).
    Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 476 of /home/user/public_html/dev/includes/unicode.inc).
chriscalip’s picture

Error Message On Node Edit Pages triggered by problem in d7 version of custom breadcrumbs.

Ideally if that bug is fixed all that needs to be done is at @ admin/config/user-interface/custom-breadcrumbs Check the Advanced Settings "Use wildcard pattern matching in paths" and on Excluded Paths add node/*/edit .

Bug is:
This setting for excluded paths is currently not being respected by the custom_breadcrumbs module hence the error.

_wdm_’s picture

The problem is still present in Drupal Core 7.9.

I have traced this back to custom_breadcrumbs_paths_cb_node_form_table from (via custom_breadcrumbs_form_node_form_alter and _custom_breadcrumbs_match_path).

This function seem to be getting a node where the path has been set to an Array (not a string).

[path] => Array
(
[pid] => 192
[source] => node/99
[alias] => news-media/sa-p-p-s-h-m
[language] => und
[pathauto] =>
)

colan’s picture

webcultist’s picture

This little fix works for me...

colan’s picture

Status: Active » Needs review
FileSize
1.38 KB

Changes to the above patch:

  • Added a comment & whitespace around stanza.
  • Removed dependency on operator precedence rules.
  • Added Git metadata.
hitfactory’s picture

Confirming patch in #10 gets rid of errors.

victoriachan’s picture

Patch on #10 works for me too. Thanks!

colan’s picture

Status: Needs review » Reviewed & tested by the community

Hopefully it's the right solution. :)

morbiD’s picture

Patch works.

As w.m. mentioned above, the problem occurs when $node->path is set to array('pathauto' => TRUE).

custom_breadcrumbs_paths_cb_node_form_table() sends this array to drupal_lookup_path() which actually requires a string.

Edit: Found a bug with the patch. See next post.

morbiD’s picture

The patch doesn't account for array('pathauto' => FALSE) (i.e. when pathauto is enabled but not generating a new alias). The condition should be isset($node->path['pathauto']) rather than $node->path['pathauto'].

I've attached a new patch.

colan’s picture

Righto, works. All I did was add Git metadata.

modestmoes’s picture

applied patch
excluding the module on node/*/edit pages
cleared cache

no more errors

Thomas_S’s picture

same error, Drupal 7.14 if "Use wildcard pattern matching in paths" is enabled.

- applied patch
- excluding the module on node/*/edit pages -> wildcard seems not work if the wildcard is not on the end of the string.

But: if I change the module weights, errors are gone.

Module weight with "Illegal offset type in isset or empty" Errors:
Custom breadcrumbs for taxonomy
Custom breadcrumbs for paths
Custom breadcrumbs for views
Custom breadcrumbs

Module weight without "Illegal offset type in isset or empty" Errors:
Custom breadcrumbs
Custom breadcrumbs for views
Custom breadcrumbs for paths
Custom breadcrumbs for taxonomy

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.32 KB

This is actually the proper fix. $node->path is *not* a string in Drupal 7 and this function *should not* be modifying the node object either.

wxman’s picture

Thank you all for the patch!
Every time I go to any node edit page, I was getting the same three errors six times over.

Message	Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower() (line 476 of /var/www/vhosts/tlthost.net/httpdocs/includes/unicode.inc).

Message	Notice: Array to string conversion in drupal_lookup_path() (line 131 of /var/www/vhosts/tlthost.net/httpdocs/includes/path.inc).

Message	Warning: Illegal offset type in isset or empty in drupal_lookup_path() (line 125 of /var/www/vhosts/tlthost.net/httpdocs/includes/path.inc).

I finally narrowed it down to the "Use wildcard pattern matching in paths" setting. The #19 patch fixed it so I could keep using wildcards in my breadcrumbs.

liquidcms’s picture

Status: Needs review » Needs work

i can confirm that #19 indeed gets rid of the errors; however wildcard paths do not work.

i have a simple path of node/*/edit with simply:

title = junk
path = node

and bcrumb on a node edit page is unaffected.

liquidcms’s picture

thought i would debug this a bit and see what's going on; turns out theme related.

i am using Omega and it breaks the cb module trying to set the bcrumb for the edit page - i could see that the path was being matched and the trail getting passed to drupal_set_breadcrumb() is correct; but it was being unaffected. Changing to Bartik and the crumb works as defined with CB.

oddly though, the actual node page which has it's trail defined by a Node setting in CB; this works ok even in Omega. I'll check Omega queue and see if i can find why Omega is forcing bcrumbs on edit pages.

dicreat’s picture

Patch on #19 works for me

A Romka’s picture

#19 works for me too. thanks!

gigabates’s picture

#19 works for me too and also fixes a related problem where the Workflow module's form was not saving values on the node edit page.

colan’s picture

Status: Needs work » Fixed

Committed #19 in 51e18d0.

@liquidcms: Sounds like a separate issue?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.