8000 fix the handling of timestamp in the MongoDBSessionHandler by hjanuschka · Pull Request #26403 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

fix the handling of timestamp in the MongoDBSessionHandler #26403

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 4 commits into from

Conversation

hjanuschka
Copy link
Contributor
Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

in the process of upgrading from 3.4 to 4.0 we stumbled upon a issue with mongo session handler.

[05-Mar-2018 11:12:57 Europe/Vienna] PHP Fatal error:  Uncaught Error: Call to undefined method Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler::createDateTime() in /opt/APP/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php:144
Stack trace:
#0 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler->updateTimestamp('96d983b59f8aef8...', 'user_obj|O:9:"k...')
#1 [internal function]: session_write_close()
#2 {main}
  thrown in /opt/APP/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php on line 144

this PR re-add's the method, that somehow got removed in 4.0 branch, whereas the interface forces to have the implemantation.

add missing createDateTime
@hjanuschka
Copy link
Contributor Author

i need help with fabbot the code is PSR2 - what am i doing wrong here?

@phansys
Copy link
Contributor
phansys commented Mar 5, 2018

#26403 (comment)
The LF previous to return statement is missing, try to apply the suggested patch:

curl https://fabbot.io/patch/symfony/symfony/26403/33f80b7659a3b757f791b5fa7ced534c0b9a06f2/cs.diff | patch -p0

@hjanuschka
Copy link
Contributor Author

@phansys 🚀 you sir deserve a ☕️ - many thx!

@xabbuh
Copy link
Member
xabbuh commented Mar 5, 2018

#24447 made some cleanup to other places where createDateTime() was used. Shouldn't we change the updateTimestamp() method similarly instead?

@xabbuh xabbuh added this to the 4.0 milestone Mar 5, 2018
@stof
Copy link
Member
stof commented Mar 5, 2018

We should indeed

@hjanuschka
Copy link
Contributor Author

@xabbuh many thx, so using new \MongoDB\BSON\UTCDateTime() instead of the method is the real fix ?
going to update my PR

@stof stof changed the title add missing method createDateTime fix the handling of timestamp in the MongoDBSessionHandler Mar 5, 2018
@hjanuschka
Copy link
Contributor Author

@xabbuh feedback adressed, looks much nicer now, many thx for your guidance 🚀

@hjanuschka
Copy link
Contributor Author

i am pretty confident, that the changes in this particular pr have nothing todo with the failing build in appveyor, anything i can do to fix this?

@stof
Copy link
Member
stof commented Mar 5, 2018

@nicolas-grekas could you check why the test about prepared command is failing on Appveyor ? is it a volatile test ?

@stof
Copy link
Member
stof commented Mar 5, 2018

Thank you @hjanuschka.

stof added a commit that referenced this pull request Mar 5, 2018
… (hjanuschka)

This PR was submitted for the master branch but it was squashed and merged into the 4.0 branch instead (closes #26403).

Discussion
----------

fix the handling of timestamp in the MongoDBSessionHandler

| Q             | A
| ------------- | ---
| Branch?       |  master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

in the process of upgrading from 3.4 to 4.0 we stumbled upon a issue with mongo session handler.

```
[05-Mar-2018 11:12:57 Europe/Vienna] PHP Fatal error:  Uncaught Error: Call to undefined method Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler::createDateTime() in /opt/APP/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php:144
Stack trace:
#0 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler->updateTimestamp('96d983b59f8aef8...', 'user_obj|O:9:"k...')
#1 [internal function]: session_write_close()
#2 {main}
  thrown in /opt/APP/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php on line 144
```

this PR re-add's the method, that somehow got removed in 4.0 branch, whereas the interface forces to have the implemantation.

Commits
-------

97d9ea8 fix the handling of timestamp in the MongoDBSessionHandler
@stof
Copy link
Member 8000
stof commented Mar 5, 2018

This PR is marked as closed instead of merged, because I rebased your contribution to apply it to the 4.0 branch instead (and I squashed the commits to clean the history). Your authorship is preserved though (see 97d9ea8)

@stof stof closed this Mar 5, 2018
@hjanuschka
Copy link
Contributor Author

saw it - many thx ❤️ (first symfony related merged pr 🚀 ). next time, if you wan't me to branch from a specific version or to squash you can just tell me 👍

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
0