-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DefaultFormRenderer: strict type fix (#220)
fixes "TypeError: preg_split() expects parameter 2 to be string, null given" for GET form if action does not contain query parameters
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/** | ||
* Test: Nette\Forms default rendering GET form. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Tester\Assert; | ||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
|
||
$form = new Nette\Forms\Form; | ||
$form->setMethod('GET'); | ||
$form->setAction('link'); | ||
$form->addCheckboxList('list') | ||
->setItems(['First', 'Second']); | ||
$form->addHidden('userid'); | ||
$form->addSubmit('submit', 'Send'); | ||
|
||
$form->fireEvents(); | ||
|
||
Assert::match('<form action="link" method="get"> | ||
<table> | ||
<tr> | ||
<th><label></label></th> | ||
<td><label><input type="checkbox" name="list[]" value="0">First</label><br><label><input type="checkbox" name="list[]" value="1">Second</label></td> | ||
</tr> | ||
<tr> | ||
<th></th> | ||
<td><input type="submit" name="_submit" value="Send" class="button"></td> | ||
</tr> | ||
</table> | ||
<input type="hidden" name="userid" value=""><!--[if IE]><input type=IEbug disabled style="display:none"><![endif]--> | ||
</form>', $form->__toString(true)); | ||
|
||
Assert::same('link', $form->getAction()); |