Comments (3)
I second that bug.
All the calls:
(string) ($config->descend('host') ?: '127.0.0.1');
yield an unwanted result.
$config->descend('host')
will always return true
, even if the <host></host>
node is empty.
This causes a serious problem here:
$this->_useLocking = defined('CM_REDISSESSION_LOCKING_ENABLED')
? CM_REDISSESSION_LOCKING_ENABLED
: ! ($config->disable_locking ?: self::DEFAULT_DISABLE_LOCKING);
! ($config->disable_locking ?: self::DEFAULT_DISABLE_LOCKING)
always returns false. Which means that _useLocking
is always false
, which means that locking is never used.
Here's an example for different values of the <disable_locking>
node:
<disable_locking>0</disable_locking>
---> ! ($config->disable_locking ?: self::DEFAULT_DISABLE_LOCKING) // false
<disable_locking>1</disable_locking>
---> ! ($config->disable_locking ?: self::DEFAULT_DISABLE_LOCKING) // false
<disable_locking>true</disable_locking>
---> ! ($config->disable_locking ?: self::DEFAULT_DISABLE_LOCKING) // false
<disable_locking>false</disable_locking>
---> ! ($config->disable_locking ?: self::DEFAULT_DISABLE_LOCKING) // false
from cm_redissession.
(string) ($config->descend('host') ?: '127.0.0.1');
The first expression to be evaluated here is $config->descend('host'). If no node exists this is falsey so the string '127.0.0.1' is returned. If a node does exist the ternary expression evaluates to the node which is then cast to a string. If a user specifies an empty node then an empty string must be what the user wants, right? I suppose it is subjective, but if you want to use the defaults then you should just not specify those nodes at all. If you do specify nodes then it will take them literally, for better or for worse.
However, the $config->descend('disable_locking') is cast directly to a bool instead of to a string first and then a bool so you are right that this is a bug. Locking is enabled if no "disable_locking" node is specified, though.
Thanks, both for the issue report.
from cm_redissession.
If a user specifies an empty node then an empty string must be what the user wants, right? I suppose it is subjective
I hadn't seen it that way, it's definitely subjective. After thinking more about it, I can see that a user may want to supplie an empty string value (even if, in the case of the <host>
node for example, it makes absolutely no sense). So, although not necessarily the most intuitive, your approach is the most flexible one.
Thanks for the bugfix!
from cm_redissession.
Related Issues (20)
- Connectivity issue with Azure Redis Cache HOT 1
- Configuration changes don't take effect HOT 3
- hard coded session expiry HOT 5
- Magento 1.7.0.2 and PHP 7.x HOT 1
- Fatal Error when compilation is enabled HOT 4
- Passing glue string after array is deprecated. Swap the parameters in colinmollenhour/credis/Client.php on line 1414 HOT 4
- Cm\RedisSession\Handler::read taking more than 6sec HOT 14
- Session storage - Too many active connections HOT 2
- Tag current version master HOT 1
- Magento 2 switching to Laminas instead of Zend (ZF2) HOT 3
- Experiencing delay problems HOT 1
- PHP Warning: Module 'redis' already loaded in Unknown on line 0 HOT 1
- Make setSaveHandler() only callable once
- Separate read-only instance from read/write instance HOT 5
- missing ConfigInterface HOT 1
- Session IDs are plain text in redis (missing hash) HOT 1
- Native Magento Redis Session extension HOT 1
- 3.0.1 can not load the session model using composer HOT 10
- How can I install a specific version of this module via modman? HOT 4
- Error cleaning cache by mode matchingAnyTag: A pipeline is already in use and only one pipeline is supported. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cm_redissession.