This module is so easy to use, I love it.
It seems for some reason the order of operators in this statement executes inconsistently (I can't explain why):
// Output plaintext instead of a link if there is a title
// without a path.
if ($path = trim($paths[$i]) && $path != '<none>') {
$trail[] = l($title, trim($paths[$i]));
}
else {
$trail[] = check_plain($title);
}
The "correct" order of operation in $path = trim($paths[$i]) && $path != '<none>' would be:
- $path != '<none>'
- trim($paths[$i]) && [result from above]
- $path = [result from above]
See http://www.php.net/manual/en/language.operators.php#language.operators.p...
So the real question is why it ever works at all :)
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | custom_breadcrumbs.patch | 812 bytes | dkruglyak |
| custom_breadcrumbs_operators.patch | 767 bytes | quicksketch |
Comments
Comment #1
dkruglyak commentedOriginal logic is wrong. The link should be dropped only if the path is trimmed to nothing, not that any trimming occurs - which could be a by-product of Token module (e.g. when you have blog/[author-uid])
My modified patch is tested and ready to go.
Comment #2
andyschm commentedAccording to that page, && is higher precedence than =, but the equivalent logical operator "and" is lower precedence... bizarre!
Anyways the above patch fixed the problem for me.
In my opinion the use of assignment in conditionals is confusing and should discouraged in general.
Comment #3
eaton commentedFixed in CVS, will be part of the 1.3 release. Thanks!
Comment #4
(not verified) commented