Problem/Motivation
jQuery.cookie behaves differently between versions.
The Drupal7-bundled jquery.cookie.js (is very old) does not encode cookie names, while jquery_update module and Drupal8 provide newer versions of jQuery.cookie plug-in, which unconditionally encode cookie name and optionally encode cookie value.
P.S.: This behavior was not obvious, thatswhy issue #2597171: Do not encode cookie name was created.
P.P.S: Style Switcher 6.x-2.0 uses its own version of jQuery.cookie which is consistent with PHP behavior. (Drupal6 does not bundled with jQuery.cookie.)
Proposed resolution
Write a workaround. An obvious solution is to follow 6.x-2.0 style and use own code instead of jQuery plug-in.
P.S.: PHP always encodes cookie value but not the name (Tested with PHPs: 5.3.29, 5.4.45, 5.5.30, 5.6.14, 7.0.0RC3). This consistency should be preserved.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | styleswitcher-optional_url_encoding-2623122-4.patch | 3.3 KB | pingwin4eg |
| #5 | styleswitcher-reformat_js_cookie-2623122-5-D6.patch | 4.02 KB | pingwin4eg |
Comments
Comment #2
pingwin4egComment #3
pingwin4egComment #4
pingwin4egComment #5
pingwin4egFor similarity of code between branches here's a reformatted
Drupal.styleSwitcher.cookie()for 6.x. This patch does not fix anything.Comment #6
pingwin4egComment #7
pingwin4egTested patches on:
So because this is a critical issue I'm going to commit this as soon as I can.
Comment #10
pingwin4eg