phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.96k forks source link

Phalcon\Mvc\Collection::save writeConcern argument should be int or string #12474

Closed Celelibi closed 3 years ago

Celelibi commented 7 years ago

Expected and Actual Behavior

When phalcon calls the save method on a collection, it passes the array argument: ["w": true] in the file phalcon/mvc/collection.zep:912. It should only pass an integer or a string as the documentation says. https://secure.php.net/manual/en/mongocollection.save.php https://secure.php.net/manual/en/mongo.writeconcerns.php

This can be a problem when the Mongo API used isn't that of the legacy mongo PHP extension. For instance, this adapter between both mongo extensions API has a specific check and fail because of the non-conformance of phalcon to the mongo API. https://github.com/alcaeus/mongo-php-adapter/blob/master/lib/Alcaeus/MongoDbAdapter/Helper/WriteConcernConverter.php#L27

Details

Jurigag commented 7 years ago

Mongo extension is not supported in phalcon for php 7. Try incubator MongoCollection class.

Celelibi commented 7 years ago

Yeah, I know. But it's easier to use an adapter for mongo than using a development version of Phalcon. And more generally, this is a non-conformance to the mongo API, even if is usually silentely ignored.

sergeyklay commented 7 years ago

It seems to me ["w": 1] can fix the issue

Jurigag commented 7 years ago

But as i told you @Celelibi collection class in phalcon 3 is only for php 5.x, not php 7.

sergeyklay commented 7 years ago

Yea, but PHP 5.6 is LTS and 7.0 not. So we will support php5 until 2019 (for Phalcon 3)

Jurigag commented 7 years ago

Yea i know this. Just if he wants to his mongo with php 7 he needs to use class from incubator.

niden commented 5 years ago

Related to #13697

Jeckerson commented 3 years ago

Since version 4.0 Mongo is separate composer package - https://github.com/phalcon/incubator-mongodb

Closing.