Kohana Валидация в кохане или ЧЯДНТ

Pablo Diguerero

Новичок
PHP:
$test = array
        (
            'field1' => 'value',
            'field2' => null
        );
      
        $validation = Validation::factory($test);
        $validation->rule('field1', 'not_empty');
      
        echo '<pre>'.print_r($test, 1).'</pre>';
          
        if($validation->check())
        {
            echo 'ok';
        }
        else
        {
            echo '<pre>'.print_r($validation->errors(), 1).'</pre>';
        }
На выходе
PHP:
Array
(
    [field1] => value
    [field2] =>
)
Array
(
    [field1] => Array
        (
            [0] => not_empty
            [1] => Array
                (
                    [0] =>
                )

        )

)
Это печалит, может я что-то делаю не так?
 
Последнее редактирование:

Pablo Diguerero

Новичок
В общем ошибка в следующем: system/classes/Kohana/Validation.php строка 310
PHP:
// Use the submitted value or NULL if no data exists
$data[$field] = Arr::get($this, $field);
нужно заменить на
PHP:
// Use the submitted value or NULL if no data exists
$data[$field] = Arr::get($this->_data, $field);
 

Здыхлик

Kohaner
Команда форума
реализация интерфейса ArrayAccess предполагает, что будет дергаться код в строке 100 при обращении к объекту как массиву.
 
Сверху