Mantis - Quercus
Viewing Issue Advanced Details
1886 major always 07-19-07 18:28 07-20-07 08:19
rjc  
sam  
normal  
closed 3.1.1  
fixed  
none    
none 3.1.2  
0001886: Assignments to function parameters cause local variables to be created which shadow the parameters ONLY IN COMPILED PHP

In MediaWiki Parser.php, there is a function extractTagsAndParams with the following signature:

function extractTagsAndParams($elements, $text, &$matches, $uniq_prefix = ''){
                static $n = 1;
                $stripped = '';
                $matches = array();

as you can see, $matches is in fact, a variable array passed by reference. In interpreted mode, this works as expected and the array passed as a parameter is assigned an empty array.

In compiled mode, the line "$matches = array()" actually creates a new local variable with an empty array which shadows the $matches parameter. Any further modifications to $matches only effect the local copy.

I suspect this is because the Java scoping semantics are coming into play with the generated code.

Notes
(0002120)
sam   
07-20-07 08:19   
This issue was fixed in 3.1.2. php/[03]44y