Please apply attached patch for contact.module, and test via the contact module's category edit screen.
-K
| Comment | File | Size | Author |
|---|---|---|---|
| #39 | less_ref_6.diff | 4.47 KB | chx |
| #38 | less_ref_5.diff | 4.48 KB | chx |
| #37 | less_ref_4.diff | 4.46 KB | chx |
| #34 | less_ref_3.diff | 4.02 KB | chx |
| #33 | less_ref_2.diff | 1.72 KB | chx |
Comments
Comment #1
chx commentedThis is nothing new. module_implements has the explanation.
Comment #2
chx commentedI have grepped for
\$form_values.*=and found quite a number:but comment.module is OK, it's a submit and it _comment_form_submit has a
return $form_values, taxonomy.module is again a submit and it's used immediately, and user_validate_picture has global $form_values which is not elegant but works.So if Zen confirms that this indeed makes $form_values immutable then we are good to go.
Comment #3
chx commentedand node.module is also OK as Zen has just patched those two lines in http://drupal.org/node/56911
Comment #4
chx commented*SIGH*
Comment #5
chx commentedCommented.
Comment #6
chx commentedShorter version.
Comment #7
dwwFYI: this will break the project module, which attempts to modify stuff in $form_values during validate in quite a few places. so, if we're going to go this route, we'll need to fix project asap...
Comment #8
dwwFYI: i just submitted #56959 as an issue against the project module to fix this (since, according to gatsby in IRC, project should never have been doing that in the first place, regardless of this fix)...
Comment #9
killes@www.drop.org commentedapplied
Comment #10
chx commentedSomeone please enlighten me what's going on! This is way over Goba's head, too.
What I have found is that removing the
$form =from$form = form_builder($form_id, $form)then it works. If I assign that to ANYTHING then validate breaks -- I tried using$form_copy = form_builder($form_id, $form)and $form_copy downwards. So, I have changed form_builder to use &$form instead.Comment #11
Zen commentedNo enlightenment to give you, but I have tested this and it looks like a winner:
Tested:
-checkboxes
-radios
-select
-general forms
-#ref
-Poll module [from what little I know about this, it works.]
Untested
-Multipage.
I think this can be RTBC'd, but probably needs another reviewer.
-K
Comment #12
chx commentedHere is the problem in an absolutely condensed form:
output is:
Comment #13
hunmonk commentedtested the latest patch on our multipage example module, and it doesn't seem to break anything.
Comment #14
chx commentedI already mailed php internals and I hope will understand what's up. But this patch is good to go.
Comment #15
chx commentedFor the record: http://marc.theaimsgroup.com/?l=php-dev&m=114400300015496&w=2
Comment #16
drummLooks like this was comitted to HEAD.
Comment #17
drummAh, missed the second half of the updates.
Comment #18
drummComitted to HEAD.
Comment #19
chx commentedI am told that using references here can lead to a php segfault so I am better to turn back to the first version with #ref as an exception.
Comment #20
chx commentedOps, this is not good, #ref is in $form.. let me think.
Comment #21
chx commentedOK, I give up. They are modifiable and that won't be fixed. One should know where are his limits. This reverts all involved parties to their RC1 state.
It seems impossible to make $form_values changeable via #ref and not modifiable via itself.
Comment #22
chx commentedWhy is it impossible? If I set $form to contain references to $form_values then all values in the latter will become references and therefore they will be changeable, too.
Comment #23
Zen commentedRevert looks good in all three files. Tested #ref and standard forms - All OK.
-K
Comment #24
eaton commentedThe patch that hit core broke views.module's ui as well. This revert fixes it. +one kajillion.
Comment #25
killes@www.drop.org commentedok, applied
Comment #26
chx commentedLet this be closed, buried six feet under and forgot...
Comment #27
Patrick Nelson commentedDoes this mean that any modules that were changed to accomodate the original change (where
$form = form_builder()became justform_builder()) will not work with this patch unless they too are reverted back?Comment #28
chx commentedI could not let this rest. This was eating me day and night. I am not sure this is 4.7 -- but it has the advantage to remove the
$refblack magic from form_builder which was really a) elegant b) non-drupalish because it was black magic.Comment #29
chx commentedMinor correction,
Comment #30
chx commentedhm, some old patch got into this.
Comment #31
webchickabusing the new 'replies to issues show up in my issues' feature so that I can remember to test this tomorrow. ;)
Comment #32
Zen commentedThis is going to be tackled (once again) in 4.8.
-K
Comment #33
chx commentedform_set_value() takes the place of #ref.
Comment #34
chx commentedKilles tells me he is not again some last minute cleanup. Tested password editing and advanced search both.
Comment #35
webchickTested password/search as well, and just clicked around generally to a bunch of different forms to see what happened. Couldn't find any errors, so marking this RTBC.
Note that there are three contrib modules that will be broken by this change:
backport:
D:\Development\Drupal\contributions HEAD\modules\backport\form.inc (308) $form['#ref'] = &$ref;
D:\Development\Drupal\contributions HEAD\modules\backport\form.inc (646) $form['pass1']['#ref'] = NULL;
D:\Development\Drupal\contributions HEAD\modules\backport\form.inc (647) $form['pass2']['#ref'] = NULL;
D:\Development\Drupal\contributions HEAD\modules\backport\form.inc (653) $form['#ref'] = $pass1;
(looks like it's a copy/paste job from the old pass code in HEAD)
HTMLTidy:
D:\Development\Drupal\contributions HEAD\modules\htmltidy\forms_api_backport.module (394) $form['#ref'] = &$ref;
D:\Development\Drupal\contributions HEAD\modules\htmltidy\forms_api_backport.module (716) $form['pass1']['#ref'] = NULL;
D:\Development\Drupal\contributions HEAD\modules\htmltidy\forms_api_backport.module (717) $form['pass2']['#ref'] = NULL;
D:\Development\Drupal\contributions HEAD\modules\htmltidy\forms_api_backport.module (723) $form['#ref'] = $pass1;
(looks like it's just taking the code from backport)
OG:
D:\Development\Drupal\contributions HEAD\modules\og\og.module (439) $form['valid_emails']['#ref'] = $valid_emails;
(my voodoo magic patch, but should be remediable by form_set_value())
Comment #36
chx commentedI repent my sins -- step by step we strayed further and further from the one and true Drupal Way with every piece of reference magic we added. So please give me redemption by committing this.
Comment #37
chx commentedComment #38
chx commentedComment #39
chx commentedRenamed function, Steven polished the Doxygen.
Comment #40
Steven commentedCommitted to HEAD. Good job.
Comment #41
Zen commentedThe commit doesn't appear to have gone through.
-K
Comment #42
Steven commentedGive it a minute :P.
Comment #43
(not verified) commented