Loading...
 
Skip to main content

JavaScript deleteCookie() function is broken (affects Internet Explorer, section edit icons)

Status
Open
Subject
JavaScript deleteCookie() function is broken (affects Internet Explorer, section edit icons)
Version
15.x
19.x
Category
  • Bug
Resolution status
New
Submitted by
Philippe Cloutier
Lastmod by
Philippe Cloutier
Rating
(0)
Description

The deleteCookie function in tiki-js.js uses an invalid date format which is not accepted by Internet Explorer (even version 11) for its expires attribute. As a result, the following line which is supposed to delete the cookie only sets its value to an empty string in Internet Explorer:

Copy to clipboard
document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01 Jan 1970 00:00:01 GMT";


This impacts code which checks for a cookie's existence, such as the following fragment from parse_first() (in parserlib.php):

Copy to clipboard
$iconDisplayStyle = ''; if ($prefs['wiki_edit_icons_toggle'] == 'y' && ($prefs['wiki_edit_plugin'] == 'y' || $prefs['wiki_edit_section'] == 'y')) { if (!isset($_COOKIE['wiki_plugin_edit_view'])) { $iconDisplayStyle = ' style="display:none;"'; } }


The above example means that plugin call and section edit icons do not get their style set to display:none by specific CSS, which causes icons to show during load, until Javascript hides these when the page load is over. This happens when wiki_edit_icons_toggle is enabled and a user of Internet Explorer has hidden icons. To reproduce, it is probably necessary to display icons, then to hide them, then to load a page.

The invalid date format was introduced no later than 2003-08-07 and remains in trunk as of r68584.

Files
  1. Js DeleteCookie Fix
Solution
Valid full date formats for Document.cookieQuestion are specified in section 3.3.1 of RFC 2616Question. The attached patch uses the preferred (first) format rather than a mixture of several.
Importance
2
Easy to solve?
8
Priority
16
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
7007
Created
Friday 25 January, 2019 20:21:28 UTC
by Philippe Cloutier
LastModif
Saturday 06 July, 2024 10:21:44 UTC


Show PHP error messages