Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003610 [Quercus] major always 07-27-09 10:33 08-27-09 11:39
Reporter tlandmann View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 4.0.0
Summary 0003610: static function variables not "really" static
Description The sample programm below prints the following (expected) in standard PHP 5.2.6:
0 1 2

In Quercus (non-compiled mode) it prints:
0 0 1

---------------------------

<?php

class class_1
{
    public static function method_1()
    {
        function_1();
    }
    
    public function method_2()
    {
        function_1();
    }
}

function function_1()
{
    static $value=0;
    echo $value++."\n";
}

function_1();
class_1::method_1();
$object=new class_1;
$object->method_2();

?>

---------------------------

I already kind of identified the problem:
"com.caucho.quercus.statement.StaticStatement:65" reads:
QuercusClass cls = env.getCallingClass();

This can't be fully correct because it returns "class_1" if the invocation of function_1() was made from the class - although the class really doesn't have anything to do with the static variable in the function.

---------------------------

QUERCUS DEVELOPERS PLEASE NOTE:
I almost spent 3 days on this bug, which completely breaks my adapted Drupal system because all the time parts of the CSS get lost (drupal_add_css() uses a static variable...).
This bug is so special that my only chance to find out what the problem was (and to invent a workaround) was to debug Resin on the Java level.

However, finding out how to do this was not easy. Netbeans just never stopped at my breakpoints, and I didn't have any idea, why. "http://wiki.caucho.com/IDE" [^] doesn't seem to be up-to-date any more. It took me ages finding out that I had to use config settings like this:
<jvm-arg>-Xdebug</jvm-arg>
<jvm-arg>-Xrunjdwp:transport=dt_socket,address=8998,server=y,suspend=n</jvm-arg>
instead of command line args to get it working.

A major step that I also took was recompiling Quercus with debug info, which also wasn't easy. I don't know if it was finally necessary but I still think so.
First I had to get all the elements needed, then I had to cope with the problem that the source code doesn't contain all classes needed to run Quercus.

To cut it short:
I could never have posted this bug without all this work because I didn't at all have it reproducible before I pinned the bug down in the debugger. I think if people go all this way to improve Resin, they help you a lot. So please also help us with these two things:
1: Offer a download with complete debug info in the .class files .
2: Write an up-to-date tutorial on how to debug Resin/Quercus.

Thanks. Keep up the good work.
Additional Information
Attached Files

- Relationships

- Notes
(0004108)
nam
07-01-09 14:52

Thanks for the report! Our own Eclipse plugin for Quercus is in the works. Nevertheless, we can certainly update our docs on how to debug Quercus at the present moment.

http://bugs.caucho.com/view.php?id=3614 [^]
 
(0004179)
nam
08-27-09 11:39

php/0249
 

- Issue History
Date Modified Username Field Change
07-27-09 10:33 tlandmann New Issue
07-01-09 14:50 nam Status new => assigned
07-01-09 14:50 nam Assigned To  => nam
07-01-09 14:52 nam Note Added: 0004108
08-27-09 11:39 nam Status assigned => closed
08-27-09 11:39 nam Note Added: 0004179
08-27-09 11:39 nam Resolution open => fixed
08-27-09 11:39 nam Fixed in Version  => 4.0.2


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