Hi guys,
The list() in the following code snippet generates an E_NOTICE error whenever $original_title does not include a pipe (|) character. It is annoying...
[...]
list($title, $title_attr) = explode("|", $original_title, 2);
if (isset($title_attr)) {
[...]
You can simply use the @ sign to remove the E_NOTICE. (although that removes all the notices: the list() and the explode() notices are hidden.)
Otherwise, you'd have to explode to an array and check the array appropriately (i.e. isset($my_array[1]) to know whether there are attributes.)
Thank you.
Alexis Wilke
Comments
Comment #1
MGN commentedYes, but I have also read it can be inefficient to ignore notice messages in this way (and can hide other errors as you mentioned) .
I suppose the best way is to do it in two steps as you describe.
Comment #2
MGN commentedHere is a patch that eliminates list in custom_breadcrumbs.module, hopefully fixing the E_NOTICE problem.
Comment #3
AlexisWilke commentedLooks good, I don't get the E_NOTICEs anymore.
Thank you.
Alexis
Comment #4
toodlepip commentedLovely, thank you, that did the job nicely.
Comment #5
MGN commentedThanks. This has now been committed to 6.x-2.x-dev.