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.
Comment | File | Size | Author |
---|---|---|---|
#5 | radioactivity-boolean-cast-2283595-5.patch | 800 bytes | Sutharsan |
#3 | radioactivity-boolean-cast-2283595-2.diff | 727 bytes | maijs |
Comments
Comment #1
maijs CreditAttribution: maijs commentedA patch is attached against latest commit in 7.x-2.x (476bda9).
Comment #2
maijs CreditAttribution: maijs commentedComment #3
maijs CreditAttribution: maijs commentedWhitespaces removed from the originally supplied patch.
Comment #4
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedworks for me, thanks!
Comment #5
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commentedPatch does not apply, re-rolling.
Comment #7
Sutharsan CreditAttribution: Sutharsan at LimoenGroen commented