Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comments
Comment #1
MGN CreditAttribution: MGN commentedI've tried, but haven't been able to reproduce this.
Comment #2
somanyfish CreditAttribution: somanyfish commentedI 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.
Comment #3
somanyfish CreditAttribution: somanyfish commentedAh, 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.
Comment #4
Ron Williams CreditAttribution: Ron Williams commentedThis 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.
Comment #5
Ron Williams CreditAttribution: Ron Williams commentedI was able to resolve the issue with deleting files by excluding the module on node/*/edit pages; however, the error still occurs:
Comment #6
chriscalip CreditAttribution: chriscalip commentedError 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.
Comment #7
_wdm_ CreditAttribution: _wdm_ commentedThe 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] =>
)
Comment #8
colanPossibly related: #1266502: Illegal offset type in isset or empty in path.module
Comment #9
webcultist CreditAttribution: webcultist commentedThis little fix works for me...
Comment #10
colanChanges to the above patch:
Comment #11
hitfactory CreditAttribution: hitfactory commentedConfirming patch in #10 gets rid of errors.
Comment #12
victoriachan CreditAttribution: victoriachan commentedPatch on #10 works for me too. Thanks!
Comment #13
colanHopefully it's the right solution. :)
Comment #14
morbiD CreditAttribution: morbiD commentedPatch works.As w.m. mentioned above, the problem occurs when
$node->path
is set toarray('pathauto' => TRUE)
.custom_breadcrumbs_paths_cb_node_form_table()
sends this array todrupal_lookup_path()
which actually requires a string.Edit: Found a bug with the patch. See next post.
Comment #15
morbiD CreditAttribution: morbiD commentedThe patch doesn't account for
array('pathauto' => FALSE)
(i.e. when pathauto is enabled but not generating a new alias). The condition should beisset($node->path['pathauto'])
rather than$node->path['pathauto']
.I've attached a new patch.
Comment #16
colanRighto, works. All I did was add Git metadata.
Comment #17
modestmoes CreditAttribution: modestmoes commentedapplied patch
excluding the module on node/*/edit pages
cleared cache
no more errors
Comment #18
Thomas_S CreditAttribution: Thomas_S commentedsame 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
Comment #19
Dave ReidThis 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.
Comment #20
wxman CreditAttribution: wxman commentedThank you all for the patch!
Every time I go to any node edit page, I was getting the same three errors six times over.
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.
Comment #21
liquidcms CreditAttribution: liquidcms commentedi 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.
Comment #22
liquidcms CreditAttribution: liquidcms commentedthought 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.
Comment #23
dicreat CreditAttribution: dicreat commentedPatch on #19 works for me
Comment #24
A Romka CreditAttribution: A Romka commented#19 works for me too. thanks!
Comment #25
gigabates CreditAttribution: gigabates commented#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.
Comment #26
colanCommitted #19 in 51e18d0.
@liquidcms: Sounds like a separate issue?