zendframework / zend-session

Manage and preserve session data, a logical complement of cookie data, across multiple page requests by the same client.
BSD 3-Clause "New" or "Revised" License
42 stars 64 forks source link

Allow using any configured save handler extension #99

Closed weierophinney closed 6 years ago

weierophinney commented 6 years ago

Per #97, the fix in 2.8.1 (provided by #92) for having SessionConfig::setPhpSaveHandler() work with PHP 7.2 was too aggressive, and prevented the ability to set the value to a known extension, such as redis.

This patch fixes that approach by grabbing a list of known save handlers from phpinfo() (after first stripping user from the list), and comparing the incoming value to that list; if it is in that list, it now uses session_module_name() to set the value.

Tests for this are next to impossible to write, unfortunately, as we would need to have multiple extensions installed on developer machines and in Travis. I have instead added tests verifying the various exceptions thrown, including one thrown when a value is in the known PHP save handlers list, but fails to be set properly.

Fixes #97.