mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Validate "0" as alphanumeric value (ticket #2972)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5461 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
549d86ac23
commit
7c5b93e34e
2 changed files with 3 additions and 1 deletions
|
@ -126,7 +126,7 @@ class Validation extends Object {
|
|||
$this->_extract($check);
|
||||
}
|
||||
|
||||
if (empty($this->check)) {
|
||||
if (empty($this->check) && $this->check != '0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertTrue($this->Validation->alphaNumeric('frferrf'));
|
||||
$this->assertTrue($this->Validation->alphaNumeric('12234'));
|
||||
$this->assertTrue($this->Validation->alphaNumeric('1w2e2r3t4y'));
|
||||
$this->assertTrue($this->Validation->alphaNumeric('0'));
|
||||
$this->assertFalse($this->Validation->alphaNumeric('12 234'));
|
||||
$this->assertFalse($this->Validation->alphaNumeric('dfd 234'));
|
||||
$this->assertFalse($this->Validation->alphaNumeric("\n"));
|
||||
|
@ -58,6 +59,7 @@ class ValidationTestCase extends UnitTestCase {
|
|||
$this->assertTrue($this->Validation->alphaNumeric(array('check' => 'frferrf')));
|
||||
$this->assertTrue($this->Validation->alphaNumeric(array('check' => '12234')));
|
||||
$this->assertTrue($this->Validation->alphaNumeric(array('check' => '1w2e2r3t4y')));
|
||||
$this->assertTrue($this->Validation->alphaNumeric(array('check' => '0')));
|
||||
$this->assertFalse($this->Validation->alphaNumeric(array('check' => '12 234')));
|
||||
$this->assertFalse($this->Validation->alphaNumeric(array('check' => 'dfd 234')));
|
||||
$this->assertFalse($this->Validation->alphaNumeric(array('check' => "\n")));
|
||||
|
|
Loading…
Add table
Reference in a new issue