Bug Report #4429

_external array for Validation loads the incorrect file

Added by Lorenzo Pisani 3 months ago. Updated 3 months ago.

Status:Closed Start date:08/06/2011
Priority:High Due date:
Assignee:Lorenzo Pisani % Done:

100%

Category:-
Target version:Kohana v3.x - v3.3.0
Resolution:fixed Points:1

Description

Test platform:
- Ubuntu 11.04
- PHP 5.3.5
- Apache 2.2.17

This error surfaces when using external validation with ORM:

$external_validation = Validation::factory($this->request->post())
  ->rule('password', 'not_empty');
try
{
  $user = ORM::factory('user', 5);
  $user
    ->values($this->request->post())
    ->update($external_validation);
}
catch (ORM_Validation_Exception $e)
{
  $errors = $e->errors('models');
}

When, errors are thrown, all the messages which apply to rules set in the model are getting loaded from the correct file (messages/models/user). External validations however, should get the errors from messages/models/user/_external.php. This doesn't happen and the ORM_Validation_Exception class instead loads the standard message.

The problem is found on line 165 of Kohana_ORM_Validation_Exception:

$file = trim($directory.'/'.$alias.'/', '/');

Which will be set to messages/models/_external.php instead of messages/models/user/_external.php


Related issues

related to ORM - Bug Report #4185: _external array for Validation loads the incorrect file Kohana v3.x - v3.2.1 Feedback 08/06/2011

Also available in: Atom PDF