Short description: When a radioactivity field has a setting with a boolean value, incident validation fails when triggered via ajax.

A problem: For a project I have a field_formatter_order (sandbox) module installed that adds a certain value to field settings, which is a boolean in this case. Also the project uses a node page (via panels) which triggers an ajax call for node energy emission.

_radioactivity_register_emitter() is the function that prepares emitter data for storing in javascript. If emitter data element is a bool (field_formatter_order => false), in javascript it becomes a string. Example:

   // ...
    "radioactivity": {
        "emitters": {
            "emitDefault": [
                {
                    // .. 
                    "field_formatter_order": false,
                    // .. 
                }
            ]
        }
    },
   // ...

When an ajax call is being made to emit.php, PHP receives the value as a string ("field_formatter_order => "false""), therefore _radioactivity_checksum_generate() function, that validates incident data checksums, cannot longer assert two incident data sets as identical as one element in both sets has different data types.

Solution: All incident data boolean values should be cast to string so that they are not cast as strings in an uncontroller manner.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maijs’s picture

A patch is attached against latest commit in 7.x-2.x (476bda9).

maijs’s picture

Issue summary: View changes
maijs’s picture

FileSize
727 bytes

Whitespaces removed from the originally supplied patch.

Jānis Bebrītis’s picture

Status: Active » Reviewed & tested by the community

works for me, thanks!

Sutharsan’s picture

Patch does not apply, re-rolling.

  • Sutharsan committed f27989f on 7.x-2.x
    Issue #2283595 by maijs, Sutharsan: Incident validation fails if...
Sutharsan’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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