If the name of a pagebreak consists only of numbers which are the same as the cid of a component, webform_component_list() returns incorrect results. This happens because webform_component_list() uses pagebreak names as an array key. cid is also used as a key. If both are the same, values will get overwritten.
Comments
Comment #2
liam morlandComment #3
danchadwick commentedI am pretty sure, but not 100% sure, that the page name (i.e. "label" in the UI) is intended only as a reference to the page. It can be any unique identifier. In this way, the code freely makes them unique by appending "_X" where X is a number.
In the situation you cite, would be possible to still have name conflicts. Suppose you have two identically-named pages "1". The first one would get renamed "1 " (with a space appended). The second one would also get the same name because there is no page name "1" yet in the array being built.
I suggest that the initial attempt for page names always have " " appended, as in:
What I don't know is which, if any, of the affected calls to webform_component_list with $pagebreak_groups == TRUE could be negatively affected. I would hope none. Conditionals seem okay.
Comment #4
liam morlandGood point about the space being added before the uniqueness check.
I don't think the space needs to be added except in the rare situations where the name is only digits.
Comment #5
liam morlandThis improves the test as well, testing for a page break with the same name as another page break.
Comment #6
liam morlandWith debugging code removed.
Comment #8
liam morland