View Issue Details

IDProjectCategoryView StatusLast Update
0000339Adventure PHP FrameworkBugpublic2018-10-08 22:04
ReporterChristianAchatzAssigned ToChristianAchatz 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.4 
Target Version4.0Fixed in Version4.0 
Summary0000339: FormControlFinder::getFormElementsByTagName() throws exception when no form element is found within FormGroup element
DescriptionForm markup:
============

<html:form name="...">

   <form:group> ... </form:group>

   <form:button name="foo" />

</html:form>


Controller/tag code:
================

$form->getFormElementsByTagName('form:button');


Method FormControlFinder::getFormElementsByTagName() does not return the button instance defined in the form but throws an exception for the above form markup.
TagsNo tags attached.
Codereferenz: ([Datei]:[Zeile])
Namespacecore

Activities

ChristianAchatz

2018-10-08 13:25

administrator   ~0000874

Analysis:
=======
Issue is caused by the fact that the form group has no child elements defined. Exception should only be thrown in case the entire sub-tree of the form has no "form:button" defined which cannot be determined within the nested run of the method.

Solution:
=======
Change signature of method to not throw exceptions but return empty list and let the caller decide how to handle "not found" use cases.

ChristianAchatz

2018-10-08 21:31

administrator   ~0000875

Same issue applies to getFormElementsByType().

ChristianAchatz

2018-10-08 22:04

administrator   ~0000876

Fix committed. See changes under https://github.com/AdventurePHP/code/commit/e8fa2eb79f3a8e263ce4f611cbaca38941304821.

Issue History

Date Modified Username Field Change
2018-10-08 13:19 ChristianAchatz New Issue
2018-10-08 13:19 ChristianAchatz Status new => assigned
2018-10-08 13:19 ChristianAchatz Assigned To => ChristianAchatz
2018-10-08 13:25 ChristianAchatz Note Added: 0000874
2018-10-08 21:31 ChristianAchatz Note Added: 0000875
2018-10-08 22:04 ChristianAchatz Note Added: 0000876
2018-10-08 22:04 ChristianAchatz Status assigned => resolved
2018-10-08 22:04 ChristianAchatz Resolution open => fixed
2018-10-08 22:04 ChristianAchatz Fixed in Version => 4.0