ZF-11068: ErrorController created by tries to call getParams() on non-object

Issue Type: Bug Created: 2011-02-12T11:37:32.000+0000 Last Updated: 2011-02-17T10:33:22.000+0000 Status: Resolved Fix version(s): - 1.11.4 (03/Mar/11)

Reporter: Magnus Olsson (xeroxer) Assignee: Benoît Durand (intiilapa) Tags: - Zend_Tool

Related issues: - ZF-10428



When using Zend_Tool to create a project running: bq. zf create project generates an ErrorController with one line trying to call getParams() on non-object.

Line 35 when finding a log instance it tries: bq. $request->getParams() but the request variable is not set.

What I think it means is: bq. $errors->request->getParams() which works as expected.

Found the line in: bq.… on line 162: bq. \$log->log('Request Parameters', \$priority, \$request->getParams());


Posted by Magnus Olsson (xeroxer) on 2011-02-12T13:03:39.000+0000

Checked the source for Zend_Log and noticed that I was wrong in thinking that $errors->request->getParams() would solve the problem. I guess everyone else knows this but doing that will just log them into the $event array with the parameter key as index. So instead of getting it into the info index in the event array it will go into controller and action, which will not work that great trying to log the info.

That would result in when trying to format a log message with: bq. %timestamp% %priorityName% (%priority%): %message% -- %info% would need to be: bq. %timestamp% [%priorityName%] (%priority%): %message% -- %controller% / %action% plus any other information that might be logged, and that's not good.

As I said earlier I guess the person working on this already figured this out but just in case. :)

Posted by Benoît Durand (intiilapa) on 2011-02-13T00:27:40.000+0000

@Magnus, your comment is related to another issue (ZF-10427).

Posted by Magnus Olsson (xeroxer) on 2011-02-13T04:23:50.000+0000

@Benoît isn't it related more to this issue since the adding of the %info% string will not solve the problem I was talking about. Sure the adding of the %info% string is more related to the other issue but that was not the point of my comment. The point was that even if the issue reported here is fixed with the solution I suggested it will not be using the logging correctly. It will be passing an array with string keys into the log and the log will insert the values into those keys instead of the info key. So even if the log string is changed to: bq. %timestamp% %priorityName% (%priority%): %message% - %info% this issue with the ErrorController will still be using it "incorrectly"?

Until this is fixed I am using the line: bq. $log->log('Request Parameters', $priority, print_r($errors->request->getParams(), true)); and then the request parameters are logged using %info%.

Sorry if I am not understanding the connection between my comment and the other issue and if that is the case I will comment that issue instead. :/

Posted by Benoît Durand (intiilapa) on 2011-02-13T05:03:31.000+0000

It's not the good issue to talk about it, because it's a design problem between the simple formatter and extra info event. %info% is mixed type. So, it's can be an array. We don't have this problem with the others writers like db, Firebug, xml stream, or ZendMonitor. I think that the issue for the extra info can be resolved in ZF2.

Posted by Benoît Durand (intiilapa) on 2011-02-17T10:33:21.000+0000

Fix in r23708

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.