Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Apr 2007 at 23:11 UTC
Updated:
16 Oct 2007 at 14:33 UTC
as i mentioned at http://drupal.org/node/67893#comment-232650 -- there's something broken with FAPI when you try to define #default_values for a multi-select form element. you get the following notice on php4:
notice: Array to string conversion in /Users/wright/drupal/cvs/6/core/includes/form.inc on line 957.
(doesn't show up on php5 for whatever reason).
anyway, attached patch (suggested by chx) solves the problem, and makes sense to me.
| Comment | File | Size | Author |
|---|---|---|---|
| fapi_default_values_multiselect.patch.txt | 750 bytes | dww |
Comments
Comment #1
dmitrig01 commentedwhat can I say?
Comment #2
dmitrig01 commentedI can say AWESOME!!
lol
Comment #3
dww@dmitrig01 thanks for the "review". ;) however, for future reference, here are some examples of (useful) things you could say when marking an issue RTBC:
(etc, etc)
... this adds legitimacy to your claim, and saves time for the core committers since they don't necessarily have to confirm all those things themselves (if you do a good enough job on enough patch reviews that they can start to trust you, at least). ;) you don't always need to list all of these, but including at least some evidence to support your claim that the patch is RTBC is definitely a good idea.
thanks,
-derek
Comment #4
dries commentedCommitted to CVS HEAD. Don't think this needs to go in DRUPAL-5 so I'm marking this fixed.
Comment #5
dwwwell, the bug is still present in 5.x, the patch still applies (with minor offset) and still fixes the bug (i just confirmed all of that, and tested). true, it's only visible on D6 because of E_NOTICE being reported, but the underlying code is still doing the wrong thing -- we really shouldn't be trying to cast arrays to strings like that... it's a logic bug in the if() clause that php is being forgiving about, and we happen to still get the right behavior. but, IMHO, it's a (minor) FAPI bug that should be backported. i've seen drumm say in other issues, basically "D5 is no excuse for bad code" in response to similar E_ALL-related bug fixes, so i'm guessing he'd be willing to commit this.
thanks,
-derek
p.s. the bug is there in 4.7 FAPI, too, but the patch doesn't apply. i'd backport if killes wanted, but i'm not sure he's gonna care. ;)
Comment #6
drummYes, individual verifiable fixes do belong in 5.
Committed to 5.
Comment #7
dwwthanks, drumm.
so, what do you say, killes? want a 4.7.x version? if not, just bump this back to 5.x or 6.x and "fixed".
Comment #8
dwwfrom killes in IRC: "dww: I think your time is better spent elsewhere."... ;)
Comment #9
dries commentedComment #10
radj commentedi was creating an Annotation module reading Chapter 2 of the April 2007 edition of Apress' Pro Drupal Development. Reading and setting the #default_value of the textarea of in the nodeapi hook (find ### in the code below) did not show anything.
when i used a textfield type, the value was shown. but i needed a textarea. after searching, i found this patch. i reversed the patch and reverted my textfield back to textarea and it worked.
am i doing something wrong?