-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix for #19183 to add support for new PHP MongoDB extension in sessions. #19186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
omanizer
commented
Jun 25, 2016
Q | A |
---|---|
Branch? | 3.0 |
Bug fix? | yes |
New feature? | yes (ish) |
BC breaks? | no |
Deprecations? | no |
Tests pass? | no |
Fixed tickets | #19183 |
License | MIT |
Doc PR |
array('upsert' => true, 'multiple' => false) | ||
); | ||
$expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use a
$fields = array(
$this->options['time_field'] => $this->createDateTime(),
$this->options['expiry_field'] => $expiry,
);
Then add the MongoDbBin part ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'd suggest keeping 2 different blocks due to the update method name changing too (update vs updateOne as well as needing the 'multiple' property passed in the options parameter for the first one. I'll modify this to condense the $fields declaration though.
Could you please update the test according to this class ? |
This is a duplicate of #18788 right? |
…ts to utilize new mongodb extension's class names if mongodb extension exists.
@ro0NL This is a dup of that PR. I should have looked harder as I didn't see that one when I created this one. Happy to move things along on this one though if desired. @Simperfit I've updated the tests accordingly. |
Looks like some builds are not passing. I hypothesize that it's due to this line: Has anyone done an "or" in a require statement before or does anyone know of a better way to accomplish this or any other thoughts? |
if ($this->mongo instanceof \MongoDB\Client) { | ||
$fields[$this->options['data_field']] = new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY); | ||
|
||
$this->getCollection()->updateOne( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do the same as before
$methodName = ($this->mongo instanceof \MongoDB\Client) ? 'updateOne' : 'update';
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. See the latest commit.
Thank you @omanizer. |
…n in sessions. (omanizer) This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #19186). Discussion ---------- Fix for #19183 to add support for new PHP MongoDB extension in sessions. | Q | A | ------------- | --- | Branch? | 3.0 | Bug fix? | yes | New feature? | yes (ish) | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #19183 | License | MIT | Doc PR | Commits ------- ebbc706 Fix for #19183 to add support for new PHP MongoDB extension in sessions.