Topic on Extension talk:Arrays

Jump to navigation Jump to search
184.20.10.253 (talkcontribs)

Extension:Arrays#Fatal bug


$egArraysExpansionEscapeTemplates is currently not initialized correctly, I think because of JSON code:

"config": {
		"ArraysCompatibilityMode": {
			"description": "Set to false by default since version 2.0.",
			"value": false
		},
		"ArraysExpansionEscapeTemplates": {
			"description": "Contains a key-value pair list of characters that should be replaced by a template or parser function call within array values included into an '#arrayprint'. By replacing these special characters before including the values into the string which is being expanded afterwards, array values can't distract the surrounding MW code. Otherwise the array values themselves would be parsed as well.\n\nThis has no effect in case $egArraysCompatibilityMode is set to false! If set to null, Arrays will jump to compatibility mode behavior on this, independently from $egArraysCompatibilityMode.",
			"value": [
				{
					"=": "{{=}}"
				},
				{
					"|": "{{!}}"
				},
				{
					"{{": "{{((}}"
				},
				{
					"}}": "{{))}}"
				}
			]
		}
	},

The PHP code produces an associative array that matches how escapeForExpansion uses it. escapeForExpansion produces a PHP diagnostic. Oddly though I didn't see it until I had a page name with an apostrophe in it. So it's possible escapeForExpansion isn't always utilized, without doing more analysis. Note, escapeForExpansion is the only consumer of $egArraysExpansionEscapeTemplates at least inside of ExtArrays.php.

$egArraysExpansionEscapeTemplates = [
	'='  => '{{=}}',
	'|'  => '{{!}}',
	'{{' => '{{((}}',
	'}}' => '{{))}}'
];
Dinoguy1000 (talkcontribs)
184.20.10.253 (talkcontribs)

Thank you, looking at https://phabricator.wikimedia.org/T240111 I suggest explaining the extension.json code is the likely source of the error. I think it was probably written in haste, since extension.json is a new framework. This report here in Talk is a better resource I think. I tried to make the explanation in the Article easy to understand without tearing into details, so people can figure out a way to initialize the variable manually, since that's the only way to fix it (without modifying the JSON file or converting the JSON result into the expected result, whichever is correct. I don't know enough about the JSON setup to solve the problem.)

184.20.10.253 (talkcontribs)

Here (Topic:Vcpmy66hprtm34jy) is attempt an editor made to hide the problem, they should be prepared to fix it them, or any case the problem is hidden now, so I hope someone is seeing it through. Someone should be interested in shepherding this new JSON system since someone saw fit to institute it.

Reply to "Nonworking status 1.33.1"