Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed issue #113 - Input fields are automatically required #526

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+2 −1
Split
@@ -485,7 +485,7 @@ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
// If the field is blank, but NOT required, no further tests are necessary
$callback = FALSE;
- if ( ! in_array('required', $rules) AND is_null($postdata))
+ if ( ! in_array('required', $rules) AND empty($postdata))
@Dentxinho

Dentxinho Jul 26, 2012

Contributor

To fix issue #113 properly, change this line to:

if ( ! in_array('required', $rules) AND in_array($postdata, array('', FALSE, NULL), TRUE))
{
// Before we bail out, does the rule contain a callback?
if (preg_match("/(callback_\w+(\[.*?\])?)/", implode(' ', $rules), $match))
@@ -140,6 +140,7 @@
<li>Fixed a bug (#89) - Fix a variable type mismatch in DB <samp>display_error()</samp> where an array is expected, but a string could be set instead.</li>
<li>Fixed a bug (#467) - Suppress warnings generated from get_magic_quotes_gpc() (deprecated in PHP 5.4)</li>
<li>Fixed a bug (#484) - First time _csrf_set_hash() is called, hash is never set to the cookie (in Security.php).</li>
+ <li>Fixed a bug (#113) - Input fields are automatically 'required' (in Form_validation.php).</li>
</ul>
<h2>Version 2.0.3</h2>