Is there any reason for a valued affectation of $form['#post'] instead of a reference affectation ?
In form.inc, function form_builder, line 892, there is
foreach (element_children($form) as $key) {
$form[$key]['#post'] = $form['#post'];
why not just a
$form[$key]['#post'] = &$form['#post'];
? On big form it should be a real memory gain.
Sorry if there is an obvious reason I didn't see...
Comments
Comment #1
Anonymous (not verified) commentedsubscribing.
Comment #2
rfaysubscribe.
Comment #3
effulgentsia commentedIt's solved in D7 (no more #post at all, $form_state['input'] instead). I don't know enough about how PHP manages array vs. array reference internals: it seems logical to think an array reference uses less memory, but PHP memory management is not always logical. I doubt it makes sense to change it for D6 though, as the change would not be entirely backwards compatible functionally. Marking "fixed" as a support request. Feel free to re-open as a "bug", especially if there's a real use-case of running out of memory that would be solved.
Comment #4
heine commentedPHP features copy on write (at least PHP 5; I erased all knowledge of PHP 4). The post array in the form points to the same data unless you modify it.