Closed (fixed)
Project:
Collapse Text
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Mar 2011 at 06:39 UTC
Updated:
10 Aug 2012 at 16:31 UTC
I got 3 E_NOTICEs with the new version (2.5), I just jumped from 1.1 to 2.5... 8-)
It otherwise seems to work just fine.
So... one set of notices came from the foreach() over the $classes variable which may call collapse_text_id_safe() with an empty string. I suggest we don't call the function at all if $s is empty.
The other, I have a doubt about it...
// the original is just: if ($tree['#title'] && ...) {
if (!empty($tree['#title']) && ($tree['#collapse_text_default_title_flag'] == 'yes')) {
$tree['#title'] = $default_title;
}
Here you set the title to $default_title if it is defined. Is that really the intend?! Shouldn't you set the title if it isn't set?
Thank you.
Alexis
| Comment | File | Size | Author |
|---|---|---|---|
| collapse_text-6.x-2.x-notices.patch | 1.16 KB | AlexisWilke |
Comments
Comment #1
pukku commentedHi! I have added a test for empty
$s.You said that you go three
E_NOTICEs. Were they all from an empty$s?Your second question is actually not a problem. The function that it is in is walking through the tree and updating the default title, if that is what was put there, to be the default title provided by the format or the user in a
[collapse options]tag. Rather than send the options hash all the way down through the recursive functions, I am being lazy and using the out-of-the-box default title, and then replacing that in a second recursive call. I probably should just suck it up and send the$optionshash through all of the recursion. But the code that you are looking at in particular is correct, because only proper FAPI elements have a#titleattribute, so it's a short hand to make sure I'm looking at an actual FAPI array.Ricky
Comment #2
AlexisWilke commentedJust raising the issue. 8-)
Now for entries that do not have the #title, it generates an E_NOTICE. The patch I attached shows the fix.
There is another E_NOTICE in that same function since the #collapse_text_default_title_flag may not be set either. Actually, a better simplification would be to unset it no matter what (I think the if() is not required.)
I think. You should get E_NOTICEs too and thus test for those issues. 8-)
Thank you.
Alexis
Comment #3
pukku commentedHi! I decided to fix the actual problem (which was my laziness) rather than the post-hoc fix I was attempting to do. I've modified the code to make the options array available through the entire recursive stack. This way, I can set the title at the right place.
I have one more fix that running with E_NOTICE made visible, and I will then release it...
Ricky
Comment #4
pukku commented