Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
wants to merge 5 commits into from

Conversation

omanizer
Copy link
Contributor

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'));

Copy link
Contributor

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 ?

Copy link
Contributor Author

@omanizer omanizer Jun 26, 2016

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.

@Simperfit
Copy link
Contributor

Could you please update the test according to this class ?

@ro0NL
Copy link
Contributor

ro0NL commented Jun 26, 2016

This is a duplicate of #18788 right?

omanizer added 2 commits June 26, 2016 15:22
…ts to utilize new mongodb extension's class names if mongodb extension exists.
@omanizer
Copy link
Contributor Author

@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.

@omanizer
Copy link
Contributor Author

Looks like some builds are not passing. I hypothesize that it's due to this line:
@requires extension mongo or mongodb not actually causing the test to be skipped when it may need to be.

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?

@ro0NL
Copy link
Contributor

ro0NL commented Jun 27, 2016

@omanizer sure, just check the feedback from that one, looks like @fabpot wants to move on with this.

@fabpot
Copy link
Member

fabpot commented Jun 28, 2016

As there is no feedback on #18788, @omanizer can you finish this one instead of closing it? You can also get some inspiration from the other PR if that makes sense for you.

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(
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@fabpot
Copy link
Member

fabpot commented Jul 1, 2016

Thank you @omanizer.

fabpot added a commit that referenced this pull request Jul 1, 2016
…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.
@fabpot fabpot closed this Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants