Closed bakos closed 2 years ago
Ater few more tests if you change order and add field first and then you try to clear it then it couse Segmentation fault (11) - only in 5.x version. 3.x and 4.x order is not a problem
$textField = new Text('textField', [
'placeholder' => 'Text field to clear after submit',
]);
$this->add($textField);
$textField->clear();
I think I'm facing the same problem. Win10, PHP 8.1.7, Phalcon v5.0.0RC2.
The script below simply freezes (with at least one element and Form->clear()
).
A "windows problem reporting" process starts running at 30% CPU, which if I kill the script terminates as well.
<?php
class TestForm extends \Phalcon\Forms\Form {
public function initialize() {
$this->add(new \Phalcon\Forms\Element\Text('test'));
// freezes with clear
$this->clear();
}
}
new TestForm;
When i use clear() on element, it goes to infinite loop!
Details: Phalcon version: 5.0.0RC3 PHP Version: 8.1.9
Resolved in https://github.com/phalcon/cphalcon/pull/16191
Thank you @bakos @Deathamns @alimo2
Describe the bug
Clear is not working on form elements values. (https://docs.phalcon.io/5.0/pl-pl/api/phalcon_forms : Clears element to its default value)
To Reproduce Steps to reproduce the behavior:
This should clear element to its default value
Form:
Action in contoller
Template view
Expected behavior
Fields values should be cleared. It works in phalcon 3.x and 4.x.
Details
Additional context
I found commit related to the problem:
https://github.com/phalcon/cphalcon/commit/9992bb24c0aaaf8518141b11dacd7433d1694cef