fix form helper set_radio

This commit is contained in:
Andrei Furnica 2018-08-02 15:55:03 +03:00
parent 25922b5cfc
commit 6b6703dab1
No known key found for this signature in database
GPG Key ID: 6408728868B34CDD
2 changed files with 9 additions and 1 deletions

View File

@ -925,7 +925,7 @@ if ( ! function_exists('set_radio'))
// Unchecked checkbox and radio inputs are not even submitted by browsers ...
$result = '';
if (!empty($request->getPost()) || !empty(old($field)))
if (!empty($input = $request->getPost($field)) || !empty($input = old($field)))
{
$result = ($input === $value) ? ' checked="checked"' : '';
}

View File

@ -756,6 +756,10 @@ EOH;
}
// ------------------------------------------------------------------------
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testSetRadio()
{
$_SESSION = [
@ -771,6 +775,10 @@ EOH;
unset($_SESSION['_ci_old_input']);
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testSetRadioFromPost()
{
$_POST['bar'] = 'baz';