-
Notifications
You must be signed in to change notification settings - Fork 62
Redis as save handler #98
Comments
Fixed with #99 and released with 2.8.2. |
Actually it wasn't fixed v 2.8.2:
v 2.8.0 everything works correctly. $config->setOption("save_handler", "redis");
$url = "tcp://" . $redisDto->getHost() . ":" . $redisDto->getPort() . "?auth=" . $redisDto->getPassword() . "&database=1";
$config->setOption("save_path", $url); |
@ikovalyov — Your diagnosis is incorrect. The change in behavior of What we are doing internally instead is, within I'm going to write a unit test based on your example above, and debug from there; I'll link this to a new pull request once I have a solution ready to review. |
The fix in zendframework#99, while correct, did not address setting the session.save_path for non-files save handlers when the save handler is set via `setOption('save_handler', $value)`. The reason for this was due to the fact that `setOption()` delegates directly to `setStorageOption()` instead of the relevant class method; the changes in zendframework#99 make that method a no-op in the case of a save handler option. What this patch does is two-fold: - It overrides `setOption()` and has it call `setPhpSaveHandler()` if `save_handler` is provided as the `$option` argument. It then returns on completion. Otherwise, it delegates to the parent. - It modifies `setPhpSaveHandler()` to extract the bulk of the logic to a new method, `performSaveHandlerUpdate()`. This new method now returns the save handler _name_ to store. `setPhpSaveHandler()` then sets that name as the `save_handler` value in the `$options` property before returning. I have added a test to verify this behavior based on an example provided in zendframework#98.
The fix in zendframework#99, while correct, did not address setting the session.save_path for non-files save handlers when the save handler is set via `setOption('save_handler', $value)`. The reason for this was due to the fact that `setOption()` delegates directly to `setStorageOption()` instead of the relevant class method; the changes in zendframework#99 make that method a no-op in the case of a save handler option. What this patch does is two-fold: - It overrides `setOption()` and has it call `setPhpSaveHandler()` if `save_handler` is provided as the `$option` argument. It then returns on completion. Otherwise, it delegates to the parent. - It modifies `setPhpSaveHandler()` to extract the bulk of the logic to a new method, `performSaveHandlerUpdate()`. This new method now returns the save handler _name_ to store. `setPhpSaveHandler()` then sets that name as the `save_handler` value in the `$options` property before returning. I have added a test to verify this behavior based on an example provided in zendframework#98.
thanks |
Provide a narrative description of what you are trying to accomplish.
Code to reproduce the issue
Expected results
It should save data in redis
Actual results
Warning: session_start(): open(tcp://redis:?auth=&database=1/sess_***, O_RDWR) failed: No such file or directory (2) in ***/vendor/zendframework/zend-session/src/SessionManager.php on line 140
Here is what I found in your code:
The 2.8.0 version looks like
If I pass redis as save_handler it's just ignored and php trying to use my redis config as default config parameters. It broken my live servers. Reverted to 2.8.0 for now.
Please fix ASAP.
Thanks.
The text was updated successfully, but these errors were encountered: