Issue with overriding MongoCollection::update

Deadly 提交于 2019-12-11 04:24:14

问题


I'm running the following version of PHP: PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 28 2012 18:19:13).

I have a class which inherits from \MongoGridFS:

class PdfGrid extends \MongoGridFS {
// ...

public function update( array $criteria , array $new_object, array $options = array()){
    $options['safe'] = true;
    if ( isset($criteria['_id']) && ! $criteria['_id'] instanceof \MongoId){
        $criteria['_id'] = new \MongoId($criteria['_id']);
    }
    return parent::update($criteria, $new_object, $options);
}
} 

Whenever I run a script that uses this class, I get the following error:

PHP Strict Standards: Declaration of YS\MongoCollection\PdfGrid::update() should be compatible with that of MongoCollection::update() in /Users/js/dev/YsInv/lib/YS/MongoCollection/PdfGrid.php on line 68

But alas, the definition matches precisely with what appears on php.net for \MongoCollection::update:

public bool|array MongoCollection::update ( array $criteria , array $new_object [, array $options = array() ] )

来源:https://stackoverflow.com/questions/16490297/issue-with-overriding-mongocollectionupdate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!