(09-04-2015, 11:33 AM)ciadmin Wrote: MY_Form_validation should go in application/core if you are extending the built-in one.
That doesn't sound right. Since it's loaded via $this->load->library('form_validation'), the library() method would call _ci_load_library(), which, in turn, would call _ci_load_stock_library(), which eventually does this:
PHP Code:
$paths = $this->_ci_library_paths;
array_pop($paths); // BASEPATH
array_pop($paths); // APPPATH (needs to be the first path checked)
array_unshift($paths, APPPATH);
foreach ($paths as $path)
{
if (file_exists($path = $path.'libraries/'.$file_path.$library_name.'.php'))
{
// Override
include_once($path);
if (class_exists($prefix.$library_name, FALSE))
{
return $this->_ci_init_library($library_name, $prefix, $params, $object_name);
}
else
{
log_message('debug', $path.' exists, but does not declare '.$prefix.$library_name);
}
}
}
In general, when overloading system classes you just put the file in the equivalent directory in application. In other words, you would override /system/libraries/Form_validation.php with /application/libraries/MY_Form_validation.php