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条)

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源