Thursday, January 8, 2015

Validation error on "baked" date field , CakePHP 3

I have a "baked" cakePHP-3.0.0 page which has a field defined as 'date_of_birth date DEFAULT NULL' in TABLE users. 
When I click the Submit for the "add" function I get 
 
Warning (2): preg_match() expects parameter 2 to be string, array given [CORE\src\Validation\Validation.php, line 763] 
Code Context   

    protected static function _check($check, $regex) 
        {
        
        if (is_string($regex) && preg_match($regex, $check)) {
       
$check = [ 
    'year' => '2014', 
    'month' => '01', 
    'day' => '01' 

$regex = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))([- /.])(?:0?2\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\d)?\d{2})([- /.])(?:(?:(?:0?[13578]|1[02])\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\2(?:0?[1-9]|1\d|2[0-8]))))$%' 
 
Any suggestion on how to fix ? 
Regards
 
    The stack trace is 
   
    preg_match - [internal], line ??   
    Cake\Validation\Validation::_check() - CORE\src\Validation\Validation.php, line 763 
    Cake\Validation\Validation::date() - CORE\src\Validation\Validation.php, line 346 
    Cake\Validation\RulesProvider::__call() - CORE\src\Validation\RulesProvider.php, line 53 
    Cake\Validation\RulesProvider::date() - CORE\src\Validation\ValidationRule.php, line 138 
    Cake\Validation\ValidationRule::process() - CORE\src\Validation\ValidationRule.php, line 138 
    Cake\Validation\Validator::_processRules() - CORE\src\Validation\Validator.php, line 554 
    Cake\Validation\Validator::errors() - CORE\src\Validation\Validator.php, line 128 
    Cake\ORM\Marshaller::_validate() - CORE\src\ORM\Marshaller.php, line 185 
    Cake\ORM\Marshaller::merge() - CORE\src\ORM\Marshaller.php, line 341 
    Cake\ORM\Table::patchEntity() - CORE\src\ORM\Table.php, line 1899 
    App\Controller\UsersController::add() - APP/Controller\UsersController.php, line 48 
    Cake\Controller\Controller::invokeAction() - CORE\src\Controller\Controller.php, line 406 
    Cake\Routing\Dispatcher::_invoke() - CORE\src\Routing\Dispatcher.php, line 114 
    Cake\Routing\Dispatcher::dispatch() - CORE\src\Routing\Dispatcher.php, line 87 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: