-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix mongo handler #6184
Fix mongo handler #6184
Conversation
@Ocramius @Nainterceptor The concern I have about this is that the change from |
@moderndeveloperllc can you open an issue on that? It would be a blocker for |
@moderndeveloperllc why not? |
@Ocramius None that I can think of other than the dislike of setting defaults in an Options constructor. I'll try and get to this soon unless you or @Nainterceptor get to it first. |
@moderndeveloperllc I don't have time for it today, but please open a bug report on it, as this is a blocker for 2.3.2 |
On a somewhat related note, was Zend/Log/Writer/MongoDB fine as-is, because it has no default write options? I believe the session adapter is the only one that had an options class. I originally implemented both of these MongoDB drivers two years ago, when driver 1.3 was pretty new. At this point, I don't think it's worth supporting the 1.2.x branch at all (I intend to remove it from Doctrine MongoDB's next minor version), but I understand if you can't simply drop support for it in a ZF patch release. |
FYI: For doing logic around the MongoDB driver, I would suggest using return version_compare(phpversion('mongo'), '1.3.0', '<')
? new \Mongo($server, $options)
: new \MongoClient($server, $options); |
@jmikola I had seen that in the test class, good to know that's the standard way. The logger is fine. You can pass save options, but there are no defaults. As far as the 1.2 branch, 1.3.0 went final on PECL in Nov. 2012 and PHP 5.3.23 (current min version) came out March 2013. However < PHP 5.4.9 might have a <1.3.0 driver, so I think ZF2 will have to keep supporting < 1.3.0 until 5.4.9 is the minimum. Yes there is not a one to one correlation, but if you haven't updated PHP, it doubtful you've updated a specific extension. jm2c |
@jmikola True, I think this default parameter is useless. MongoClient::getWriteConcern() return, by default, w => 1 and wtimeout => 500 Other way is $ext = new ReflectionExtension('mongo');
$ext->getVersion(); |
There's no need to construct a ReflectionExtension instance when
I don't see any correlation between when versions of PHP and the MongoDB driver were released. The driver is not bundled with PHP as a core extension; instead, it's installed through PECL (a one-minute compilation). http://pecl.php.net/package/mongo also provides compiled binaries for Windows, so there is really no reason for someone to be on 1.2.x at this point. If they are, I do doubt they're using ZF2 and even less likely the session or log adapters. I'd defer to @Ocramius to make that decision, though. |
I talk to you about getWriteConcern only to attract your attention to the fact that this param is useless for recent MongoClient. I think it's the simplest solution, like your previous link (Zend/Log/Writer) |
…odb-flags-replacement' Close zendframework/zendframework#6184
…odb-flags-replacement' into develop Close zendframework/zendframework#6184 Forward Port zendframework/zendframework#6184
Hello,
First of all, tests pass :
This fix is about the last version of php-mongo driver, where safe option is deprecated.
More informations here : http://www.php.net/manual/fr/mongo.writeconcerns.php#mongo.writeconcerns.options
On my dev environnement (archlinux), a lot of "deprecated" messages are present without this fix.