Problem/Motivation

$.fn.jsCallback currently uses this code:
js_token: (module && callback && Drupal.settings.js && Drupal.settings.js.tokens && Drupal.settings.js.tokens[module + '-' + callback]) || null.
This leads to the string "null" being posted for js_token.
This again leads to trouble with anonymous token verification as the check ($is_anonymous && empty($_js['token'])) in js_execute_request() wont work.

Proposed resolution

Simply use an empty string instead null:
js_token: (module && callback && Drupal.settings.js && Drupal.settings.js.tokens && Drupal.settings.js.tokens[module + '-' + callback]) || ''.

Remaining tasks

Reviews needed.

User interface changes

API changes

CommentFileSizeAuthor
js-js_token-do-not-use-null-in-js.patch564 bytesdas-peter
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

  • markcarver committed fb52f20 on 7.x-2.x authored by das-peter
    Issue #2478695 by das-peter: Do not use NULL in JS for js_token - it's...
markhalliwell’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.