nicktacular / php-mongo-session

A PHP session handler with a Mongo DB backend.
MIT License
18 stars 6 forks source link

Added support for apps using namespaces #22

Open PhilLehmann opened 9 years ago

PhilLehmann commented 9 years ago

For coherency, I had to place the class into a namespace (not included in this fix of course).

Prior to the fix, class_exists('MongoClient') would fail, as MongoClient was not in the same namespace, hence the change to class_exists('\MongoClient').

Two issues were fixed regarding session timeout:

Thanks for this awesome class!

nicktacular commented 9 years ago

Hi @philrykoff thank you for your contribution.

Regarding the namespaces, I'm still maintaining PHP 5.2.17+ support at this moment so the code needs to make this check carefully since \MongoClient isn't a valid classname prior to 5.2.17.

However, unless a namespace is declared, there should be no issues with classes not used with the full namespace:

php > class_exists('MongoClient');
php > var_dump(class_exists('MongoClient'));
bool(true)
php > var_dump(phpversion());
string(5) "5.6.3"
php > 

I would ask that you verify that you have the mongo extension loaded and running.

I would also ask that you split up your PR and separate the cookie/session settings and I will merge that.

PhilLehmann commented 9 years ago

Hey @nicktacular - done!

fedorovvldmr commented 7 years ago

@nicktacular, merge please