Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.5.5, 2.6.2
-
Component/s: JavaScript
-
Testing Instructions:
-
Affected Branches:MOODLE_25_STABLE, MOODLE_26_STABLE
-
Fixed Branches:MOODLE_25_STABLE, MOODLE_26_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-44061-master -
Pull Master Diff URL:
Description
Technically, JSON can have a number of whitespace characters. At present, ajax_check_captured_output() complains about all of these, but perhaps it should not.
JSON technically only allows the following whitespace characters[1]:
- tabulation (U+0009);
- linefeed (U+000A);
- carriage return (U+000D); and
- space (U+0020).
However, outputting whitespace has other consequences which need to be considered. Although most of the content that we return for AJAX_SCRIPTs is JSON, the path where these whitespace characters is seen is not always limited to JSON. For example, any repository library which contains whitespace will be caught by this check but will also have an impact on non AJAX Scripts - for example it will prevent header changes and/or redirects which will have a negative impact on other parts of the code.
That said, catching things in JS handling script is perhaps not the most obvious thing.
If we do decide to do this, we would need to pass the list of acceptable parameters to trim as PHP's trim function removes:
- tabulation (U+0009) - fine;
- linefeed (U+000A) - fine;
- carriage return (U+000D) - fine;
- space (U+0020) - fine;
- the NUL-byte (U+0000) - not in agreement; and
- the vertical tab (U+000B) - not in agreement.
[1] See the bottom of section 4 (JSON Text) of http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf. At the top of page 8 of the PDF / 2 of the document.
Attachments
Issue Links
- caused a regression
-
MDL-44635 lib/tests/ajaxlib_test.php are causing output in unit tests
-
- Closed
-