drlq92444 2012-07-20 03:08
浏览 21
已采纳

Zend模型声明与抽象不兼容

Even that my system is still functioning properly my error-log is suddenly overflowding with errors like these:

2012-07-20T02:53:25+00:00 WARN (4): [2048] Declaration of User_Model_User::getParent() should be compatible with Core_Model_Item_Abstract::getParent($recurseType = NULL) ([…]/application/modules/User/Model/User.php) [20]
Error Code: 1b29e1
Stack trace:
#0 […]/application/libraries/Engine/Loader.php(103): include_once('/dana/data/www.altandetlige.dk/d...')
#1 (unknown file)(0): Engine_Loader::autoload('User_Model_User')
#2 (unknown file)(0): spl_autoload_call('User_Model_User')
#3 […]/application/libraries/Zend/Db/Table/Rowset/Abstract.php(114): class_exists('User_Model_User')
#4 […]/application/libraries/Zend/Db/Table/Abstract.php(1340): Zend_Db_Table_Rowset_Abstract->__construct(Array)
#5 […]/application/libraries/Zend/Db/Table/Abstract.php(1290): Zend_Db_Table_Abstract->fetchAll('((`engine4_users`.`user_id` = 1)...')
#6 […]/application/modules/User/Api/Core.php(334): Zend_Db_Table_Abstract->find(1)
#7 […]/application/modules/User/Api/Core.php(167): User_Api_Core->_getUser(1)
#8 […]/application/modules/User/Bootstrap.php(34): User_Api_Core->getViewer()
#9 […]/application/modules/Core/Bootstrap.php(783): User_Bootstrap->__construct(Core_Bootstrap)
#10 […]/application/libraries/Engine/Application/Bootstrap/Abstract.php(256): Core_Bootstrap->_initModules()
#11 […]/application/libraries/Engine/Application/Bootstrap/Abstract.php(207): Engine_Application_Bootstrap_Abstract->_executeResource('modules')
#12 […]/application/libraries/Engine/Application/Bootstrap/Abstract.php(150): Engine_Application_Bootstrap_Abstract->_bootstrap()
#13 […]/application/libraries/Engine/Application.php(149): Engine_Application_Bootstrap_Abstract->bootstrap()
#14 […]/application/index.php(193): Engine_Application->bootstrap()
#15 […]/index.php(24): include('/dana/data/www.altandetlige.dk/d...')
#16 {main}

All Models using the Core_Model_Item_Abstract will produce the exact same error.

The strange thing is that the error only show on the production server (running PHP 5.4.3) and not on the development setup (running PHP 5.2.11).

From the error it is clear that the Core_Model_Item_Abstract do not seem to get the expected parameters, but no changes have been make to the Core_Model_Item_Abstract and if it was the case it would properly show in both production and development.

[EDIT]

The parent class in Core_Model_Item_Abstract looks like this. For me it seems like the code is already taking into account that $recurseType is not set:

public function getParent($recurseType = null) {
    if( empty($recurseType) ) $recurseType = null; // Parent and owner are same
    if( !empty($this->_parent_is_owner) ) { 
        return $this->getOwner($recurseType); 
    }
}

Anybody have any thoughts on this?

  • 写回答

3条回答 默认 最新

  • douping3427 2012-07-20 03:31
    关注

    Change

    class User_Model_User {
        function getParent() {
        ...
    

    to

    class User_Model_User {
        function getParent($recurseType = NULL) {
        ...
    

    and the problem should go away. This change will not break anything, but will only quiet your logs.

    Or you could do this:

    abstract class Core_Model_Item_Abstract 
    {
      public function getParent(/*$recurseType = NULL*/)
      {
          $recurseType = NULL; # forcing to null as no one is passing this parameter
          ...
      }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?
  • ¥15 讲解电路图,付费求解