Last modified: 2009-11-26 03:14:49 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.
Er, what on earth is {{{{{{{{{1}}}}}}}}} supposed to do? Please provide sample input and sample expected and actual output.
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.
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 . . .
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.
This has been FIXED with the introduction of the new preprocessor.