jenssegers / laravel-mongodb-session

A MongoDB session driver for Laravel
77 stars 27 forks source link

Problem with the new PHP MongoDB Extension #15

Closed omanizer closed 8 years ago

omanizer commented 8 years ago

This isn't necessarily an issue with the code in this library but rather the code in Symfony that this library depends on. SessionManager.php depends on MongoDbSessionHandler.php from Symfony which is biased to only work with the PHP Mongo Extension having several classes from that extension hardcoded.

I've filed an issue with Symfony here: https://github.com/symfony/symfony/issues/19183

It would be worthwhile to have an interim solution until the fix for this propagates. I suggest one of the following:

1) Create/utilize a "shim" that essentially defines all of the Mongo classes, namely, Mongo, MongoClient, MongoId, MongoDate, and MongoBinData that are expected/used by MongoDbSessionHandler.php. This could completely overcome the issue with the exception of MongoDbSessionHandler.php Line 73.

2) Create a temporary alternate MongoDbSessionHandler.php file that is used if the MongoDB\Client class exists.

I'd suggest (2) since (1) is not a complete solution.

@jenssegers, what are your thoughts? I'm happy to submit a PR for this today.

omanizer commented 8 years ago

This has been fixed in the Symfony core and should no longer be an issue. https://github.com/symfony/symfony/issues/19183