Details
Description
When trying to set some string value containing quotes for such params like "cmi.interactions.n.learner_response", or
"cmi.comments_from_learner.n.comment" , "cmi.suspend_data", some strange behaviour is shown:
1. when string contains single quote (apostrophe) it gets unnecessary slashes before apostrophes stored in database
changing line 259 in mod/scorm/locallib.php as follows seems to fix it
$id = insert_record('scorm_scoes_track',$track, false);
original code just makes double quoting![]()
2. when string contains double quote (") , this value can't be processed in JavaScript functions, calls to API just return npthing, and setted value is ignored, without even a failure result code. I suspect the reason is usage of eval in datamodels/scorm_1x.js.php, like that:
if (element == 'cmi.comments') { eval(element+'+="'+value+'";'); } else { eval(element+'="'+value+'";'); }
Issue Links
| This issue is duplicated by: | ||||
| MDL-12857 | eval() quote escaping |
|
|
|
| MDL-11884 | Line 511 of mod/scorm/API.PHP does not escape single quotes |
|
|
|
| MDL-15854 | [PATCH] Use addslashes_js on firstname and lastname |
|
|
|
| This issue has a non-specific relationship to: | ||||
| MDL-8191 | String datatypes defined in datamodels/scorm_13.js.php reject newlines |
|
|
|
| MDL-6904 | scorm package add problem in catalan i18n |
|
|
|
| This issue has been marked as being related by: | ||||
| MDL-8935 | Javascript strings not correctly scaped causes failure on some components |
|
|
|
Assigning to Sadiel for prioritising and fixing.