Skip to content

[3.0] Theme split (wave 4, part 4) — close the theme picker's form - #9388

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-picker-form
Open

[3.0] Theme split (wave 4, part 4) — close the theme picker's form#9388
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-picker-form

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Part of the split of #7933, wave 4 part 4. The theme picker, template_pick() in
Themes.template.php.

Two things wrong with it, both visible in the served page:

The form is never closed. <form action="…?action=themechooser" …> is opened
and there is no </form>, so where the form ends is left to the browser's error
recovery rather than to the markup.

The hidden fields are echoed twice. They sit inside the for ($i = 0; $i < 2; $i++) loop that draws the current theme in one pass and everything else in the
other, so the session variable, the security token and u are each emitted once
per pass.

Testing

Measured on the rendered page at ?action=themechooser;u=1, counting the fields
of the picker form:

fields duplicated
release-3.0 8 session var ×2, pick-th token ×2, u ×2
this branch 5 none

Both save[…] buttons and both theme sections are still inside the form
afterwards, and submitting it still saves the theme.

To submit it at all I first needed #9387ThemeChooser fatals on an unimported
class before it gets as far as saving. That one is a separate PR since it is a
Sources/ bug rather than a template one.

The one thing I would flag: the browser does not, in practice, swallow the footer
into the unclosed form — it closes it at the enclosing element. So this is invalid
markup and duplicated fields rather than anything user-visible today.

Issues References (Fixes|Related|Closes)

Related to #7933

template_pick() opens a form and never closes it, so where it ends is left to the
browser's error recovery rather than the markup. The session variable, the
security token and the member id are echoed inside the loop that runs once for the
current theme and once for the rest, so each of them is sent twice.

Closes the form after the loop, and echoes one set of hidden fields.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant