[eluser]xzyfer[/eluser]
Hi All,
before the obligatory 'sigh, not this again', i have read all the relating post and have not found one that dealt with a similar issue.
I am trying to extend CI_Exceptions to add a show_403 function, simple enough dont you think?
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class My_Exceptions extends CI_Exceptions {
function __construct()
{
parent::CI_Exceptions();
echo ' loaded My_Exceptions'; //make sure this is being loaded
}
/**
* 403 Access Forbidden Handler
*
* @access private
* @param string
* @return string
*/
function show_403($page = '')
{
$heading = "403 Access Forbidden";
$message = "You do not have access to this page.";
log_message('error', '403 Access Forbidden --> '.$page);
echo $this->show_error($heading, $message);
exit;
}
}
?>
couldn't be simpler... but calling <?php show_403(); ?> in my code results in:
Fatal error: Call to undefined function show_403()
Strangely enough, if i rename my show_403 function to show_404, but keeping the same function body, i get the desired page. This tells me that my extension is being loaded and my extended function is being used, in this case.
However by simply changing the name back to show_403, i get the fatal error again.
What's even stranger is that if i take the above function and add it into the CI_Exceptions file directly, and comment out the show_403 function in my extended class, i get the same Fatal error?!
I thought for a moment that in CI there was some kind of function pooling for all these functions, but that would defeat the dynamic nature of the product, which i am a big fan of btw.
I am at a loss guys, any help would be great!