[X] Bug fix (involves code and configuration changes)
About
Add a preg_replace() to ElementHexa::decode() so incoming strings are filtered of all non hexadecimal characters. Resolves #683.
Also remove check for the BOM (feff) if it exists. The existing function does a check for characters '00' at the beginning of the string to decide whether to 4-byte or 2-byte decode this string. It does not account for the 4-byte BOM and decodes such a string in a 2-byte fashion. It depends on further functions (in this case Parser::parseHeaderElement()) to repair the incorrectly decoded contents. Removing Checking for the BOM allows ElementHexa::decode() to return the correctly decoded contents the first time.
Checklist for code / configuration changes
In case you changed the code/configuration, please read each of the following checkboxes as they contain valuable information:
[X] Please add at least one test case (unit test, system test, ...) to demonstrate that the change is working. If existing code was changed, your tests cover these code parts as well.
[X] In case you fix an existing issue, please do one of the following:
[X] Write in this text something like fixes #1234 to outline that you are providing a fix for the issue #1234.
[ ] After the pull request was created, you will find on the right side a section called Development. There issues can be selected which will be closed after the your pull request got merged.
Type of pull request
About
Add a
preg_replace()
toElementHexa::decode()
so incoming strings are filtered of all non hexadecimal characters. Resolves #683.Also
removecheck for the BOM (feff
) if it exists. The existing function does a check for characters '00' at the beginning of the string to decide whether to 4-byte or 2-byte decode this string. It does not account for the 4-byte BOM and decodes such a string in a 2-byte fashion. It depends on further functions (in this caseParser::parseHeaderElement()
) to repair the incorrectly decoded contents.RemovingChecking for the BOM allowsElementHexa::decode()
to return the correctly decoded contents the first time.Checklist for code / configuration changes
In case you changed the code/configuration, please read each of the following checkboxes as they contain valuable information:
fixes #1234
to outline that you are providing a fix for the issue#1234
.