Last modified: 2009-11-26 03:14:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 8579 - Use of {{{{{{{{{1}}}}}}}}} in a template fails
Use of {{{{{{{{{1}}}}}}}}} in a template fails
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-01-11 14:41 UTC by Peter Harrison
Modified: 2009-11-26 03:14 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Peter Harrison 2007-01-11 14:41:03 UTC
I know this is as per the documentation but it looks more like a bug to me.  Add a space to the opening braces - {{{ 
{{{{{{1}}}}}} - and it will work.

The issue is in Parser.php near the end of replace_callback.  At the end of the 'close' case, the code says:

$currentCbList = $callbacks[$piece['brace']]['cb'];
while ( $piece['count'] ) {
	if ( array_key_exists( $piece['count'], $currentCbList ) ) {
		$lastOpeningBrace++;
		$openingBraceStack[$lastOpeningBrace] = $piece;
		break;
	}
	--$piece['count'];
}

If, after dealing with the first include, there are more than 3 remaining opening braces, this will have the effect of 
reducing the opening brace count to 3.  I would suggest that this be changed to something like:

$currentCbList = $callbacks[$piece['brace']]['cb'];

if ( $piece['count'] < $callbacks[$piece['brace']]['max'] ) {
	$lastOpeningBrace++;
	$openingBraceStack[$lastOpeningBrace] = $piece;
} else {
	while ( $piece['count'] ) {
		if ( array_key_exists( $piece['count'], $currentCbList ) ) {
			$lastOpeningBrace++;
			$openingBraceStack[$lastOpeningBrace] = $piece;
			break;
		}
		--$piece['count'];
	}
}

Note that the above code snippet is untested.
Comment 1 Brion Vibber 2007-01-11 20:22:14 UTC
Er, what on earth is {{{{{{{{{1}}}}}}}}} supposed to do?

Please provide sample input and sample expected and actual output.
Comment 2 Peter Harrison 2007-01-11 22:25:12 UTC
Sorry - I was looking at the example in Help:Advanced Templates.

{{tvvv | 1=foo | foo=bar | bar=biz}} using Template:tvvv containing "{{{{{{{{{1}}}}}}}}}" gives {{{bar}}}.

I believe the output should be 'biz'.  As per my report above, if you modify Template:tvvv so that it contains{

{{{ {{{{{{1}}}}}}}}}

you will get the result 'biz'.  However, putting the space the other side - {{{{{{{{{1}}}}}} }}} - will still give 
the output {{{bar}}}.  This is inconsistent.  Either all three cases should give {{{bar}}} or they should all give 
biz.  For a sample that produces 'biz', see my user page on Wikipedia (User:Prh47bridge) and it's subpage 
(User:Prh47bridge/test).

The limit on roducing the value of a parameter whose name depends on the value of another parameter may be intended 
as a feature but, looking at the inconsistent behaviour and the code snippet above, it looks like a bug to me.  It 
seems the code is trying to make sure it there is a callback available for the number of open braces left.  This 
deals successfully with cases where there is only 1 open brace left to process, eliminating it from the stack.  
However, where there are 4, 5 or 6 unmatched, it will reduce the number to 3, causing the issue above.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-01-11 22:35:41 UTC
Brion, I believe the idea is that {{{{{{{{{foo}}}}}}}}} should work something like ${${$foo}} in 
PHP, just as {{{{{{foo}}}}}} currently acts like ${$foo}.  Whether that's useful, I don't know . . .
Comment 4 Peter Harrison 2007-01-11 23:32:30 UTC
Spot on Simetrical.  I really must learn to explain myself better!

I'm not convinced that it would be a terribly useful feature so I don't see this as a huge problem, but software that 
behaves inconsistently always annoys me!  In this particular case, it looks to me like the original intention of the 
code was to produce the behaviour described by Simetrical.
Comment 5 P.Copp 2009-11-26 03:14:49 UTC
This has been FIXED with the introduction of the new preprocessor.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links