Sometime an error occur that CI controller not found - php

I am working on a codeigniter project. My website is going good but sometime an error occur that CI controller not found in core/codeigniter.php line number 234. I'm not able to find exact problem. Please provide me a valid solution. Thanks in advance for your efforts.
Here is how line number 234 looks like
function &get_instance()
{
return CI_Controller::get_instance();
}
One thing that is amazing me that this error occcur sometime not quite oftenly.

Check your controller name. Controller name should always start with a capital letter. As shown below.
Controller_name.php

Related

The Bug Genie 'undefined function make_url()'

PHP Fatal error: Call to undefined function thebuggenie\core\helpers\make_url() in ../core/helpers/TextParser.php on line 706
This is the error that I keep getting when trying to set up the VCS-integration successfully in The Bug Genie. It is an issue tracker that has VCS (git) integration. The commits can be linked to a project, and with the correct commit-message to the right issue using a git-hook. Then you can view the commit in the issue tracker. Apparently the commit is getting linked to the project, but it doesn't get linked to the issue because of the error. Can anybody help me?
The source code on GitHub.
Thanks in advance!
I've found the solution. There appears to be an error in the vcs-integration. Apparently the ui.inc.php-library is not loaded when using the git-hook.
So the temporary solution (until they solve it) is:
At modules/vcs_integration/Vcs_integration.php:226, add:
framework\Context::loadLibrary('ui');
As far as i see, make_url function is defined in a global namespace, but is called from namespace thebuggenie\core\helpers. So i suppose that's your problem

ModX Evo: PHP error in document.parser.class.inc.php

So my Evo site stopped working the other day - just got a 500 error. I got my host to check the logs and found this:
[error] PHP Fatal error: Cannot redeclare insert_metka() (previously declared in
/home/mysite/public_html/manager/includes/document.parser.class.inc.php(790) : eval()'d code:2)
in /home/mysite/public_html/manager/includes/document.parser.class.inc.php(790) : eval()'d code on line 12
I have tired commenting out the offending line and removing the entire file to no avail. Does anyone know what this means and how to fix it?
EDIT: the code at line 790:
eval ($pluginCode);
Looks like a bad plugin has broken your site. Disable all your plugins and reinstate them one at a time until it breaks again, then you know which one is the culprit.
Once you've done that, post the plugin code here and we can help you debug it further. You shouldn't ever need to modify the MODX source code.
The problem is likely to be solved by wrapping the insert_metka() declaration like this:
if(!function_exists('insert_metka')) {
function insert_metka() {
// function code
}
}
http://wiki.modxcms.com/index.php/Creating_Snippets#Wrap_functions_inside_.21function_exists_conditional_if_the_resource_is_needed_to_run_more_than_once_on_a_page
That appears like a very simple problem. You are declaring insert_metka() two times. Remove it from one of the mentioned files. Once it is declared in saved file and apparently second time you are trying to declare it with the help of eval()
Cannot redeclare insert_metka() says that you are declaring a function twice (may be with your evals).
You should check on your included files.
To be sure to not include more than one time, you can use include_once or requiere_once instead of include and requiere
Accoring to document.parser.class.inc.php this line i guess you are using OOP.
So what you can do is create instantiation class for above class and then overwrite it.
There are other things too. you might declaring same function inside of same class.

kohana 3.0.12 how to log

i am working on an website on kohana 3.0.12 and i have installed a module that loggs me some errors. All works fine, except that, when i want to effectively log an error, i get an error and i don;t know how to manage it.
Here is the messy code:
public static function handler(Exception $e)
{
// It's a nice time to log :)
Kohana::$log->add(Kohana::ERROR, Kohana_Exception::text($e));
etc code here
well that Kohana_Exception::text($e) causes an exception like: Call to undefined method Kohana_Exception::text() ? i guess it is a framework bug. any idea of how i can solve the problem? (i guess i should use another instance but Kohana_Exception:: but what instance?)
thank you
You get this error because neither Kohana_Exception nor Exception classes don't have text() method. I think the author of the module wanted to write like this:
Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e));
I belive the exception handling in 3.0 is located in the Kohana class. Try Kohana::exception(), or look in api guide if that isn't it.

Symfony2 FOSUserBundle Registration Role Exception

i am quite new in Symfony2, i`ve tried to use FOSUserBundle, most of it works fine, but when i try to register i do always get same result:
Warning: Invalid argument supplied for foreach() in /var/www/own/envelope/vendor/bundles/FOS/UserBundle/Model/User.php line 372
500 Internal Server Error - ErrorException
And in Stack Trace i can see that this is caused the empty array with Roles, but i really do have no idea where i can find it or what i should add to configs or somewhere else.
I didn`t override any controlers, only template for registration, but i think i use proper one.
Thanks for answers.
I deleted the method getGroups and addGroups from my custom User Class and it solved the problem.
Ok, i did found what is a problem - i didn't add any Role for Group. So in FOSUserBundle each Group has to have a Role, that`s it.
I'm not sure if my problem was exactly the same but atleast it was similar. The error message was the same. After searching for hours I finally understood what went wrong and looking back it has actually been an obvious mistake.
The only thing I had to do was add the following line to the __constructor function of the user class:
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
It may not have been the OPers solution but maybe it can help someone else!
i got exactly same error but i solved this by constructor overloading of user class
public function __construct(){
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
return parent::__construct();
}

class_exists returns true but still getting a Class not found error

if (class_exists('PhpThumb')) {
$pt = PhpThumb::getInstance();
$pt->registerPlugin('GdReflectionLib', 'gd');
}
if (in_array('PhpThumb', get_declared_classes())) {
$pt = PhpThumb::getInstance();
$pt->registerPlugin('GdReflectionLib', 'gd');
}
Either of these codes blocks throw the following error: "PHP Fatal error: Class 'PhpThumb' not found"
Can anyone explain why? Is this a bug in PHP?
I've encountered the same bug. In my case problem was due to mixed Russian and English letters in class name which looks similar.
I had a legacy code running under a newer version of PHP (5.3.10). I had some require_once() statements that was not doing their job. As I could change, I changed them do include() and it worked again.
I guess it have something to do with the PHP version, because running under a previous version the website was ok.
This happened for me when I was requiring a file not needed by a phpunit class I was running. The file was there, but I got the error.
Yet for a test that does need that class, the same include call works.
My work around was to have 2 config files, where 1 requires that class file and the 2nd file doesn't. So when not needed, I use the latter.
A little clunky with 1 extra small file (that I shouldn't have to create .. cse' la vie), but unblocks the issue here
After spending few hours on practicing with this mistakefullish fatal error...I've admitted that this function doesn't work with SPL autoload! And I've finally found a solution :
I replace 'class_exists()' by 'file_exists()' with a little bit more process to find out the real path of the class file (my classes have the same name as their filename).
Hope it helps.

Categories