Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Use PHP ext mongodb instead of mongo for v3 #33

Open
sandrokeil opened this issue Mar 7, 2016 · 11 comments
Open

Use PHP ext mongodb instead of mongo for v3 #33

sandrokeil opened this issue Mar 7, 2016 · 11 comments

Comments

@sandrokeil
Copy link
Contributor

The Zend\Session\SaveHandler\MongoDB should use the new MongoDB extension which runs also under PHP 7 and should not rely on the deprecated extension mongo which is not compatible with PHP 7.

I think it should based on the official MongoDB PHP library. We can add this library to the suggest Composer section.

What do you think?

@Maks3w
Copy link
Member

Maks3w commented Mar 7, 2016

@sandrokeil
Copy link
Contributor Author

I didn't try it but I think we should update the handler. I can bring a PR if it is accepted.

@weierophinney
Copy link
Member

@sandrokeil - please do! Also, we should definitely target the official wrapper, and not arbitrary third party wrappers.

@sandrokeil
Copy link
Contributor Author

Maybe it's better to not rely on mongo-php-library and use the low level functions of the MongoDB Driver. It's more work, but we have a dependency fewer. I will update my PR depending on the decision.

@Maks3w
Copy link
Member

Maks3w commented Mar 29, 2016

I prefer remove the support to the old mongo driver and focus the efforts only in the new mongodb extension. But this is not BC,

/fw @weierophinney

@weierophinney
Copy link
Member

@Maks3w ext/mongo has been deprecated, and, more importantly, does not support PHP 7. We need to migrate away from it.

Additionally, the page linked by @sandrokeil says specifically:

Application developers should consider using this extension in conjunction with the » MongoDB PHP library, which implements the same higher level APIs found in MongoDB drivers for other languages.

I'd argue the code in this component (and other ZF components) falls directly into that category. As such, the requirements should be:

  • ext/mongodb
  • mongodb/mongodb (at stability ^1.0)

Chances are, if a developer is using mongo already in their application, and using ext/mongodb, they will be using the MongoDB PHP library anyways, so this will not be an additional dependency for them, and will help simplify our own code.

@Maks3w
Copy link
Member

Maks3w commented Mar 29, 2016

My point is we fall under the same scenario of removing zend-crypt from zend-mail.

If we remove the support for ext/mongo this should happen on next major version because composer won't alert about the change in the dependency. Old users must install the new extension.

@weierophinney
Copy link
Member

@Maks3w Not true; composer honors extension constraints. As such, if the extension is missing when you run composer install, it will fail. At that point, you would need to select a new constraint for zend-session (to install the older version), or install the new extension.

@Maks3w
Copy link
Member

Maks3w commented Mar 29, 2016

There aren't required extensions defined https://github.com/zendframework/zend-session/blob/master/composer.json#L15-L18

And I guess we won't add mongodb because is only required for only one specific savehandler.

May we could try to add the old extension as a conflicted dependency. But many other libraries may require the old extension.

@sandrokeil
Copy link
Contributor Author

What's about to use a class alias like in prior versions of stdlib?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-session; a new issue has been opened at laminas/laminas-session#23.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants