Zend framework Zend ACL-日志文件中出现异常错误

Zend framework Zend ACL-日志文件中出现异常错误,zend-framework,zend-acl,Zend Framework,Zend Acl,这有点奇怪,因为我在日志文件中看到了这些错误,它们都与我拥有的任何资源都不对应。事实上,我甚至无法识别错误文件中显示的任何这些资源 2010-12-26T12:19:46+00:00 ERR (3): Error Message Resource 'res' not found 2010-12-26T12:19:46+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->ge

这有点奇怪,因为我在日志文件中看到了这些错误,它们都与我拥有的任何资源都不对应。事实上,我甚至无法识别错误文件中显示的任何这些资源

2010-12-26T12:19:46+00:00 ERR (3): Error Message Resource 'res' not found 2010-12-26T12:19:46+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->get('res') #1 /var/www/application/library/My/Controller/Plugin/Acl.php(29): Zend_Acl->isAllowed('guest', 'res', '2127250264.html') 2010-12-26T12:50:21+00:00 ERR (3): Error Message Resource 'fcs' not found 2010-12-26T12:50:21+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->get('fcs') #1 /var/www/application/library/My/Controller/Plugin/Acl.php(29): Zend_Acl->isAllowed('guest', 'fcs', 'ident2') 2010-12-26T12:50:22+00:00 ERR (3): Error Message Resource 'open' not found 2010-12-26T12:50:22+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->get('open') #1 /var/www/application/library/My/Controller/Plugin/Acl.php(29): Zend_Acl->isAllowed('guest', 'open', '1') 2010-12-26T12:19:46+00:00错误(3):未找到错误消息资源“res” 2010-12-26T12:19:46+00:00错误(3):堆栈跟踪#0/var/www/application/library/Zend/Acl.php(691):Zend_Acl->get('res') #1/var/www/application/library/My/Controller/Plugin/Acl.php(29):Zend_Acl->isAllowed('guest','res','2127250264.html')) 2010-12-26T12:50:21+00:00错误(3):未找到错误消息资源“fcs” 2010-12-26T12:50:21+00:00错误(3):堆栈跟踪#0/var/www/application/library/Zend/Acl.php(691):Zend_Acl->get('fcs') #1/var/www/application/library/My/Controller/Plugin/Acl.php(29):Zend_Acl->isAllowed('guest','fcs','ident2')) 2010-12-26T12:50:22+00:00错误(3):未找到错误消息资源“打开” 2010-12-26T12:50:22+00:00错误(3):堆栈跟踪#0/var/www/application/library/Zend/Acl.php(691):Zend_Acl->get('open') #1/var/www/application/library/My/Controller/Plugin/Acl.php(29):Zend_Acl->isAllowed('guest','open','1') Resource res、fcs、open或2127250264.html—这些不是我的应用程序中的资源—因此我不确定这些错误的含义

有人能告诉我如何调试这个吗


编辑

类My_Controller_Plugin_Acl扩展了Zend_Controller_Plugin_抽象{ private$\u acl=null; 公共函数构造(Zend_Acl$Acl){ $this->_acl=$acl; } 公共功能预分配(Zend_Controller_Request_Abstract$Request){ //与前面的示例一样,经过身份验证的用户将具有用户角色 $role=(Zend_Auth::getInstance()->hasIdentity()) “用户” :“客人”; $controller=$request->getControllerName(); $action=$request->getActionName(); $requestUri=Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(); $session=new Zend_session_名称空间('lastRequest'); //临时修复不将视图图像保存为上次请求的URL if(strpos($requestUri,'snapshot')==false&&&&$controller!='register'&&&&$controller!='login'&&&$action!='view image'&&&$action!='play video'&&&$action!='config'){ //仅当请求的操作未登录时才保存该操作 $session->lastRequestUri=$requestUri; } 如果(!$this->_acl->isAllowed($role,$controller,$action)){ //如果用户没有访问权限,我们通过更改请求将其发送到其他地方 $request->setModuleName('default') ->setControllerName('登录') ->setActionName('log'); } } }
这是我定义资源的类

class My_Acl extends Zend_Acl { public function __construct() { //Add a new role called "guest" $this->addRole(new Zend_Acl_Role('guest')); //Add a role called user, which inherits from guest $this->addRole(new Zend_Acl_Role('user'), 'guest'); //Add a resource called page $this->add(new Zend_Acl_Resource('video')); $this->add(new Zend_Acl_Resource('error')); $this->add(new Zend_Acl_Resource('index')); $this->add(new Zend_Acl_Resource('login')); $this->add(new Zend_Acl_Resource('register')); $this->add(new Zend_Acl_Resource('profile')); $this->add(new Zend_Acl_Resource('edit-profile')); $this->add(new Zend_Acl_Resource('css')); $this->add(new Zend_Acl_Resource('js')); $this->add(new Zend_Acl_Resource('images')); $this->add(new Zend_Acl_Resource('snapshots')); //Finally, we want to allow guests to view pages $this->allow('guest', 'css'); $this->allow('guest', 'js'); $this->allow('guest', 'snapshots'); $this->allow('guest', 'images'); $this->allow('guest', 'error'); $this->allow('guest', 'login'); $this->allow('guest', 'index'); $this->allow('guest', 'register'); $this->allow('guest', 'profile','view-profile'); $this->allow('guest', 'profile','view-image'); $this->allow('guest', 'profile','all-videos'); $this->allow('guest', 'profile','all-fans'); $this->allow('guest', 'profile','favorite-artists'); $this->allow('guest', 'profile','favorite-videos'); $this->allow('guest', 'video','display-thumb'); $this->allow('guest', 'video', 'config'); $this->allow('guest', 'video', 'play'); $this->allow('guest', 'video', 'play-video'); $this->allow('guest', 'video', 'new-videos'); $this->allow('guest', 'video', 'category'); $this->allow('guest', 'video', 'index'); $this->allow('guest', 'video', 'search'); $this->allow('user', 'video'); $this->allow('user', 'profile'); } } 类My_Acl扩展Zend_Acl{ 公共函数构造(){ //添加名为“来宾”的新角色 $this->addRole(新的Zend_Acl_角色(“guest”); //添加一个名为user的角色,该角色从guest继承 $this->addRole(新的Zend_Acl_角色('user'),'guest'); //添加名为page的资源 $this->add(新的Zend_Acl_资源(“视频”); $this->add(新Zend_Acl_资源('error'); $this->add(新的Zend_Acl_资源('index'); $this->add(新的Zend_Acl_资源('login'); $this->add(新的Zend_Acl_资源('register'); $this->add(新的Zend_Acl_资源('profile'); $this->add(新的Zend_Acl_资源(“编辑配置文件”); $this->add(新的Zend_Acl_资源('css'); $this->add(新的Zend_Acl_资源('js'); $this->add(新的Zend_Acl_资源(“图像”); $this->add(新的Zend_Acl_资源(“快照”); //最后,我们希望允许来宾查看页面 $this->allow('guest','css'); $this->allow('guest','js'); $this->allow('guest','snapshots'); $this->allow('guest','images'); $this->allow('guest','error'); $this->allow('guest','login'); $this->allow('guest','index'); $this->allow('guest','register'); $this->allow('guest','profile','view-profile'); $this->allow('guest'、'profile'、'view-image'); $this->allow('guest'、'profile'、'all-videos'); $this->allow('guest'、'profile'、'all-fans'); $this->allow('guest'、'profile'、'favorite-artists'); $this->allow('guest'、'profile'、'favorite-videos'); $this->allow('guest'、'video'、'display-thumb'); $this->allow('guest','video','config'); $this->allow('guest'、'video'、'play'); $this->allow('guest'、'video'、'play video'); $this->allow('guest'、'video'、'newvideos'); $this->allow('guest'、'video'、'category'); $this->allow('guest'、'video'、'index'); $this->allow('guest'、'video'、'search'); $this->allow('user','video'); $this->allow('user','profile'); } }
我猜(在没有看到My/Controller/Plugin/Acl.php的情况下)您是从Controller/module/action名称派生资源的。有人访问了您不希望访问的URL(可能来自您应用程序的旧版本,该应用程序以前有不同的URL)

我最近收到了同样的奇怪消息。正如Tomáš建议的那样,我查看了apache访问日志,发现其中一个css表单请求的文件丢失了

因此,当您的公用文件夹中有一个丢失的文件时,可能会出现如下错误

2011-02-22T02:44:49+03:00调试(7):未找到资源“css”
/usr/local/Zend/Acl.php(777):Zend_Acl->get('css'))
/home/www/public\u html/application/plugins/AccessControl.php(61):Zend\u Acl->isAllowed('guest','css','img')


要解决这个问题,只需在css、html等中查找并删除丢失文件的请求

请在
Acl.php
中向我们展示代码。请用代码更新问题-谢谢-这是一个全新的网站-尚未投入生产-仍在测试中-因此没有旧版本的网站。我已经发布了Acl.php的代码-感谢您的时间,我假设没有定义的路由调用控制器或操作(bein class My_Acl extends Zend_Acl { public function __construct() { //Add a new role called "guest" $this->addRole(new Zend_Acl_Role('guest')); //Add a role called user, which inherits from guest $this->addRole(new Zend_Acl_Role('user'), 'guest'); //Add a resource called page $this->add(new Zend_Acl_Resource('video')); $this->add(new Zend_Acl_Resource('error')); $this->add(new Zend_Acl_Resource('index')); $this->add(new Zend_Acl_Resource('login')); $this->add(new Zend_Acl_Resource('register')); $this->add(new Zend_Acl_Resource('profile')); $this->add(new Zend_Acl_Resource('edit-profile')); $this->add(new Zend_Acl_Resource('css')); $this->add(new Zend_Acl_Resource('js')); $this->add(new Zend_Acl_Resource('images')); $this->add(new Zend_Acl_Resource('snapshots')); //Finally, we want to allow guests to view pages $this->allow('guest', 'css'); $this->allow('guest', 'js'); $this->allow('guest', 'snapshots'); $this->allow('guest', 'images'); $this->allow('guest', 'error'); $this->allow('guest', 'login'); $this->allow('guest', 'index'); $this->allow('guest', 'register'); $this->allow('guest', 'profile','view-profile'); $this->allow('guest', 'profile','view-image'); $this->allow('guest', 'profile','all-videos'); $this->allow('guest', 'profile','all-fans'); $this->allow('guest', 'profile','favorite-artists'); $this->allow('guest', 'profile','favorite-videos'); $this->allow('guest', 'video','display-thumb'); $this->allow('guest', 'video', 'config'); $this->allow('guest', 'video', 'play'); $this->allow('guest', 'video', 'play-video'); $this->allow('guest', 'video', 'new-videos'); $this->allow('guest', 'video', 'category'); $this->allow('guest', 'video', 'index'); $this->allow('guest', 'video', 'search'); $this->allow('user', 'video'); $this->allow('user', 'profile'); } }