In playing around with the module, my log files have been filling up with some rather interesting errors:

Notice: Trying to get property of non-object in _custom_breadcrumbs_get_trail_items() (line 437 of /.../drupal/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module).

The interesting nature of this problem seems to stem from a value being tested which does not exist. Having done an output from dd($breadcrumb, 'BREAD') I get this:

BREAD: stdClass Object
(
    [bid] => 12
    [name] => BC Trail
    [titles] => n/a
    [paths] => <url-path-trail>
    [visibility_php] => return arg(3) == '' ? TRUE:FALSE;
    [specific_path] => my-path/*
    [language] => en
    [breadcrumb_type] => path
)

BREAD: Array
(
)

BREAD: Array
(
)

In source, I see the following function trying to set a value:

      $options = _custom_breadcrumbs_identifiers_option($i + 1, $breadcrumb->bid);

Here is a suggested patch to avoid this unwanted result.

CommentFileSizeAuthor
_custom_breadcrumbs_get_trail_items.patch1012 byteswilco

Comments

tarmstrong’s picture

I had this same error message, but it was showing up because a custom module was passing in an array to _custom_breadcrumbs_get_trail_items():

$items = _custom_breadcrumbs_get_trail_items(array(), $titles, $paths);

I managed to fix the error without hacking custom_breadcrumbs with the following change to the custom code:

$breadcrumb = new stdClass;
$breadcrumb->bid = NULL;
$items = _custom_breadcrumbs_get_trail_items($breadcrumb, $titles, $paths);

This works because _custom_breadcrumbs_identifiers_option() just needs something passed as the bid argument, but does nothing with it.

Do you have custom code passing blank arrays into _custom_breadcrumbs_get_trail_items()?

wilco’s picture

Thank you for your reply tarmstrong.

That makes sense. In reviewing a custom module, I did in fact find exactly what you noted above.

This sort of edit should exist in the notes of the module.

Cheers.

wilco’s picture

Status: Active » Closed (fixed)
wilco’s picture

Issue summary: View changes

Corrects a typo in the content.