开发者

Testing a form with missing elements gives me an error with is ErrorController.php

开发者 https://www.devze.com 2023-04-06 03:02 出处:网络
I\'m doing some testing to my login form but I notice that If I dont send all the expected parameters, I get this error:

I'm doing some testing to my login form but I notice that If I dont send all the expected parameters, I get this error:

Fatal error: Call to a member function hasResource() on a non-object in C:\demo\application\controllers\ErrorController.php on line 47

for example this test code gives me error:

public function testLoginPage ()
{
    $this->request->setMethod('POST')->setPost(
    array('username' => 'foobar');

    $this->dispatch('/usuario/login');
}

But if I send all the elements everything works as expected:

public function testLoginPage ()
{
    $this->request->setMethod('POST')->setPost(
    array('username' => 'foobar','password' => 'secret');
    $this->dispatch('/usuario/login');
}

Is this normal? I dont understard why I get an error on ErrorController.php, where is the connection?

(I thought that maybe is something that not loading, but why is it working when all elemnts are?)

Any help understanding this will be appreciated.

Thanks

Update:

I just change to an incorrect password for db database in the application.ini and that gives me the same error. Now I dont even think is the form but maybe开发者_JAVA技巧 some call at the bootstart that is depending to the Zend_Auth identity. But what means that Fatal error: Call to a member function hasResource() on a non-object? how to load that object?


Read the error message you get. You're calling hasResource() on a non-object in ErrorController.php. Your error controller is broken, but that's not really the issue here.

The issue is that there's an exception being thrown somewhere (possibly in your form, bootstrap, or anywhere really) which triggers the error controller. Fix or disable the error handler to get the exception message and stack trace to find out your problem.

To disable the error handler

$front = Zend_Controller_Front::getInstance();
$front->setParam('noErrorHandler', true);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号