Commit daed2b1
committed
fix: MemcachedHandler::decrement() wrong sign on missing key
MemcachedHandler::decrement() passed $offset as Memcached::decrement()'s
initial_value, which is used as-is (not decremented from) when a key
doesn't exist yet. That made a fresh key end up at +$offset instead of
the -$offset every other cache handler (File, Redis, Predis) produces.
Memcached counters are unsigned, so they can't hold a negative initial
value the way the other handlers effectively can. Use 0 instead (also
Memcached::decrement()'s own default), so a fresh key at least stops
going the wrong direction.
Updates the existing MemcachedHandlerTest::testDecrement() expectation
and adds a changelog entry.1 parent a826e69 commit daed2b1
3 files changed
Lines changed: 9 additions & 4 deletions
File tree
- system/Cache/Handlers
- tests/system/Cache/Handlers
- user_guide_src/source/changelogs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
184 | | - | |
185 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
0 commit comments