Closed (fixed)
Project:
Scald: Media Management made easy
Version:
7.x-1.x-dev
Component:
Scald core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Sep 2015 at 11:50 UTC
Updated:
8 Oct 2015 at 09:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pieterdcPatch attached, unassigning myself and putting to 'Needs review'.
Comment #4
pieterdcAutomated tests failed in places I didn't touch.
Rerolled the patch against 7.x-1.x, which had to be done anyway.
Let's see how it goes now.
Comment #5
nagy.balint commentedHi, thanks for the patch!
I think we should also check if its a string or not after checking if its an array, so if its a string we can md5 there as well, and if its not a string then we would add the value unaltered. Though most of the cases it will be a string i think.
So something like
So then in case of giving a string value, it will always have md5 result at the end.
Comment #6
nagy.balint commentedbecause of comment #5
Comment #7
nagy.balint commentedActually there are bigger problems here, since if I give it an array like
scald_render(200,'sdl_editor_representation', array('link' => 'test'));
Then it will give me an error:
Warning: json_decode() expects parameter 1 to be string, array given in drupal_json_decode() (line 5111 of includes/common.inc).
So the problem is that if its an array then the following line fails:
So maybe the best is to always convert to json if its an array at the very beginning of the render function.
@jcisio what do you think?
Comment #8
gifad commentedFix for #7
Comment #9
nagy.balint commentedThanks, but it does not include 5
Comment #10
gifad commented#8 does not include the fix you suggested in #5, but it does fix the issue you mentioned.
It just skips the useless decode step of an array $options, which is passed unchanged to following steps.
At least it works for me; did you try it ?
Comment #11
nagy.balint commentedNo it does not fix it...
As you can see the string is md5 coded in the patch... now if you just input a json encoded string, then it wont be md5 coded, and therefore two identical options array will be considered as different.
Comment #12
nagy.balint commentedSo something like this.
Comment #14
nagy.balint commentedThanks, Committed.