Summary: HHVM's JSON parsing is lax in some respects: it allows trailing commas in arrays and objects; allows single quotes around strings; ignores trailing text in some cases; and allows control characters U+0001–U+001F to appear unescaped in strings, which includes tab (U+0009, \t), carriage return (U+000D, \r), and linefeed (U+000A, \n).
Templates or modules generating JSON with these errors for things like <mapframe> and <graph> will be accepted under HHVM but will be (correctly) rejected under PHP7. Such templates/modules should be fixed to produce valid JSON.
Sorry if this is not the right way to go about doing this. I have recently been adding the Highway system OSM map template to many pages without highway maps. This template basically displays a map with the red line being the highway the page is about and the green line being the highways that are part of the same system.
Normally, it renders like this:
However, in PHP7 it displays this error:
(Plaintext: <mapframe> Couldn't parse JSON: Syntax error).
What confuses me is why this new version of PHP would affect any template or Lua module. Even though this issue is specific to this one template so far, it seems rather odd that the new implementation of PHP would mess with any of the template and module code.
Steps to Reproduce:
- Log into https://en.wikipedia.org.
- In the "Beta" tab, make sure PHP7 is checked.
- Go to a page using the Highway system OSM map template (in this example, the Doto Expressway page).
- Purge the page to erase the cache, or preview the page in Edit mode, then you will see this bug.
I am using Firefox 64. This issue has happened on every page with this template whenever I have PHP7 turned on.
Thank you in advance for helping.