我收到了这样的调试日志
2014-07-22 11:42:17 Notice: Notice (8): Undefined index: pass in [/htdocs/lib/Cake/View/Helper/PaginatorHelper.php, line 111]
Trace:
PaginatorHelper::beforeRender() - CORE/Cake/View/Helper/PaginatorHelper.php, line 111
ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, line 130
HelperCollection::trigger() - CORE/Cake/View/HelperCollection.php, line 153
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, line 245
View::render() - CORE/Cake/View/View.php, line 462
Controller::render() - CORE/Cake/Controller/Controller.php, line 938
ExceptionRenderer::_outputMessage() - CORE/Cake/Error/ExceptionRenderer.php, line 263
ExceptionRenderer::error400() - CORE/Cake/Error/ExceptionRenderer.php, line 209
ExceptionRenderer::render() - CORE/Cake/Error/ExceptionRenderer.php, line 165
ErrorHandler::handleException() - CORE/Cake/Error/ErrorHandler.php, line 127
[main] - [internal], line ??
我不知道,如何找到此错误的来源?我该怎么做才能找到它?
关于分页符的错误日志中的另一个条目是:
2014-07-22 12:39:30 Warning: Warning (2): array_merge() [<a href='http://php.net/function.array-merge'>function.array-merge</a>]: Argument #2 is not an array in [/htdocs/lib/Cake/View/Helper/PaginatorHelper.php, line 111]
Trace:
array_merge - [internal], line ??
PaginatorHelper::beforeRender() - CORE/Cake/View/Helper/PaginatorHelper.php, line 111
ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, line 130
HelperCollection::trigger() - CORE/Cake/View/HelperCollection.php, line 153
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, line 245
View::render() - CORE/Cake/View/View.php, line 462
Controller::render() - CORE/Cake/Controller/Controller.php, line 938
ExceptionRenderer::_outputMessage() - CORE/Cake/Error/ExceptionRenderer.php, line 263
ExceptionRenderer::error400() - CORE/Cake/Error/ExceptionRenderer.php, line 209
ExceptionRenderer::render() - CORE/Cake/Error/ExceptionRenderer.php, line 165
ErrorHandler::handleException() - CORE/Cake/Error/ErrorHandler.php, line 127
[main] - [internal], line ??
另一个问题:
2014-07-22 12:22:03 Error: [MissingControllerException] Controller class ImgController could not be found.
#0 /htdocs/app/webroot/index.php(99): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
有时,人们会在浏览器地址栏中键入最有趣的内容,从而导致日志文件中出现MissingControllerException。
在这种情况下,最佳做法是什么?忽略并删除此类日志?
答案 0 :(得分:1)
第一步应该是查看源代码以检查代码实际上要执行的操作。
$this->options['url'] = array_merge($this->request->params['pass'], $this->request->params['named']);
所以似乎你设法取消CakeRequest::$params['pass']
,也可能CakeRequest::$params['named']
。默认情况下,它们是空数组,并且保持不变,直到它们必须填充某些内容。
也许你有一些奇怪的路由,或者你甚至在你的代码中某处篡改了CakeRequest::$params
,或者你偶然发现了一个bug,谁知道,这几乎无法从这里说出来
至于丢失的控制器异常,它当然取决于它实际造成的内容,这也无法从这里看出 - 也许你会显示完整的日志条目,但是我们仍然不知道任何事情关于你的应用程序内部,所以......
你必须弄清楚实际原因,然后你可以决定做什么。如果它只是一个拼写错误的URL,那么您当然可以忽略它,甚至删除这些条目,以防您不希望它们使日志混乱,和/或您不想等待{{3}启动的功能。