Repository navigation
4.3.3: the control UniqueID separator is configurable; the default stays '$' (back-port of #1623) - #1624
Open
belisoful wants to merge 3 commits into
Open
4.3.3: the control UniqueID separator is configurable; the default stays '$' (back-port of #1623)#1624belisoful wants to merge 3 commits into
belisoful wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Back-port of #1623 for #1612 to 4.3.3. The separator between the IDs of a control
UniqueIDis configurable, and the default stays$, so nothing changes for an application that does not set it.Changes
TControl::getIdSeparator()/setIdSeparator()are static, as in 4.4.DEFAULT_ID_SEPARATOR, the 4.4 name, equalsID_SEPARATOR($) here.ID_SEPARATORis not deprecated on 4.3._,.and[. Anything else throwsTInvalidDataValueException(control_idseparator_invalid).TPageServiceIdSeparatorsets it from the configuration and is refused afterinit().IdSeparator=":"is the 4.4 default and passes OWASP Core Rule Set rule 942290.TRadioButton::getUniqueGroupName(),TJuiEventParameter::getControl(), andTDatePicker, including the'$day','$month'and'$year'literals ingetDateFromPostData().Client script
The check box, radio button and rating list scripts (
controls.js,activecontrols3.js,ratings.js) built each item'sEventTargetasListName$cN.TCheckBoxList::getPostBackOptions()sends the separator asIdSeparator, and the five sites use it, with$when the option is absent.Hidden field
idAs in 4.4, the
idof aTClientScriptManagerhidden field is its name.renderHiddenFieldsInt()rendered it asstrtr($name, ':', '_'), andcheckHiddenField()inajax3.jsreplaced only the first:. Both were no-ops for a$name. WithIdSeparator=":"they would disagree on a name with two colons, and a hidden field registered under aUniqueIDwould render the control'sClientIDas itsid, duplicating the control's own element.Behavior change in a point release: a hidden field name with a literal
:keeps it in theid; it was_. No framework control registers such a name. HISTORY.md and the "Upgrading from v4.3.2" list say so.Tests
testHiddenFieldNameSpecialCharacters()asserted the colon mapping and istestHiddenFieldIdIsItsName(). New tests cover the$default, a set separator throughgetUniqueID(),getClientID(),convertUniqueIdToClientId()andfindControl(), valid and invalid separators, theTPageServiceproperty, and theTDatePickerandTRadioButtonnames under$and:. Existing tests and Playwright specs are unchanged.php-cs-fixer, PHPStan, the full unit suite (PHP 8.2), ESLint and vitest pass. The active check box, radio button and rating list Playwright specs pass in Chromium with the default and with
IdSeparator=":"set on the harness application for the run; with:and without the client script change, the list specs fail. The 37 active-controls specs pass in Chromium after the hidden field change. PHP 8.1, the other browsers and the rest of the Playwright suite were not run locally.