Mantis Bugtracker

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004047 [Quercus] block always 05-23-10 16:32 03-12-13 19:56
Reporter Chris Graham View Status public  
Assigned To nam
Priority normal Resolution unable to reproduce Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.0.7
  Product Build
Summary 0004047: Very complex problem with variable referencing
Description I have been struggling for the last 12 hours to narrow down a very complex problem. Quercus is taking variable references when it should not be, inside complex array/object structures. Unfortunately I could not narrow it down in the time I've spent because it is such as weird problem related possibly to scope in loops/functions, nesting arrangements in the data structures, and the way data is copied back through (falsely held) references.
Steps To Reproduce
Additional Information I have attached a complex test case. It highlights the difference in behaviour between Zend PHP and Quercus.

I think this is a really critical problem, as it seems impossible to remedy or detect this in an easy way and likely affects a lot of systems with complex parse structures.
Attached Files  test.php [^] (3,233 bytes) 05-23-10 16:32

- Relationships

- Notes
05-31-10 03:12

Hi Chris, I am having the same sort of (critical) problem using references (which works partially it seems) using Drupal 6.16 against latest in SVN. I'm trying to pinpoint the occurance of this bug for a day or so. Currently the bug tracker has a problem when uploading files, .. could you paste the contents of the test.php here or email it to me at ?

Thank you!

05-31-10 03:15

What I forgot to mention is that I have a problem with a php object after referencing to it from a method and cloning it (copy object).

I hope you can send me the test.php quickly for I'm eager to solve/find this issue (and it's cause) as well.
05-31-10 06:46





// Should display 101112 ; on Quercus displays 101010
for ($i=10;$i<13;$i++)
    echo $x->bits[0][2][0]->bits[0][1];

function read_single_uncompiled_symbol($text,&$symbol_pos,$symbol_len)
    $param=array(); // Note about Quercus: I have simplified the code to assume there's only a single param to go in here. However I did find if the array is removed and we write into a direct variable then the bug does not happen.

    while (true)

        switch ($mode)
            case SYMBOL_PARSE_PARAM:
                switch ($next)
                    case '}':
                        return $ret;

                    case '{':


            case SYMBOL_PARSE_NAME:
                if ($starting)
                        case '$':
                            continue 2;
                switch ($next)
                    case '}':
                        return $ret;

                    case ',':
                        $param[0]=new ocp_tempcode();


        if ($symbol_pos>=$symbol_len)
            return array(TC_KNOWN,'',array());

function do_template($parameters)

    if (isset($TEMPLATE_CACHE)) // Primed cache. However on Quercus, as the call to "->bind" tampered with the cache data too, this is already hard-bound and thus returns the same result
        return $_data;

    // Re-parse

    $text='{$BLAH,{VAR}}'; // I've hard-coded a template for this bug report, and simplifed the parsing to just assume it is reading in a single symbol
    $out=new ocp_tempcode();

    return $out->bind($parameters,$codename); // On Quercus, $out ends up altered, which should be impossible

class ocp_tempcode
    var $bits=array(); // A list of tripes; each triple is: component type, name/data, binding parameters.

    function attach($attach)

    function bind(&$parameters,$codename)
        $out=new ocp_tempcode();

        foreach ($this->bits as $bit)
            if ($bit[0]==TC_SYMBOL) // Binds data to symbols
                foreach ($bit[2] as $i=>$param)
                    $bit[2][$i]=$param->bind($parameters,$codename); // On Quercus "$param->bind($parameters,$codename);" is actually modifying $param, which should be impossible

            if ($bit[0]==TC_PARAMETER)
                $out->attach($parameters[$bit[1]]); // The actual binding operation
            } else

        return $out;
Chris Graham
05-14-11 09:56

I thought I'd give Quercus another try, but this is still happening :(.
05-15-11 02:00

I tried this again some time earlier. These kind of parse issue were such a risk I removed Quercus in our project and I'm using php5-fpm instead. Now we are using services to get data from and to php. It's a shame Quercus does not have a nice testing suite to do a correct regression test (see php unit tests within php packages).

Good luck to you Chris.

Hopefully Quercus will grow up any time soon.
03-12-13 19:56

Unable to reproduce in 4.0.35. Thanks Chris and everyone else for the detailed bug report. I believe this issue was fixed a few months back. Drupal 6 works like a charm on Quercus. If you run into any new issues, I promise to look into them immediately.

- Issue History
Date Modified Username Field Change
05-23-10 16:32 Chris Graham New Issue
05-23-10 16:32 Chris Graham File Added: test.php
05-23-10 16:39 Chris Graham Issue Monitored: Chris Graham
05-31-10 03:10 sblommers Issue Monitored: sblommers
05-31-10 03:12 sblommers Note Added: 0004620
05-31-10 03:15 sblommers Note Added: 0004621
05-31-10 06:46 sblommers Note Added: 0004622
05-14-11 09:56 Chris Graham Note Added: 0005243
05-15-11 02:00 sblommers Note Added: 0005244
05-16-11 02:44 kdecherf Issue Monitored: kdecherf
03-12-13 19:54 nam Status new => assigned
03-12-13 19:54 nam Assigned To  => nam
03-12-13 19:56 nam Status assigned => closed
03-12-13 19:56 nam Note Added: 0006218
03-12-13 19:56 nam Resolution open => unable to reproduce

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
45 total queries executed.
33 unique queries executed.
Powered by Mantis Bugtracker