Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005185 [Quercus] minor always 08-21-12 10:44 08-23-12 15:10
Reporter matthiasblaesing View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0005185: Marshalling (php->enum) of null for enums fails
Description When testing quercus for internal systems I noticed, that some aspects of our internal api could not be used, as the system failed to correctly marshal null values for enums.

---------- Minimal example: -----------

===== File: Test.java ======
public class Test {
    public void testEnum(TestEnum x) {
        System.out.println(x);
    }
}

===== File: TestEnum.java ======
public enum TestEnum { A, B }

===== File: test.php =====
<?

import Test;
import TestEnum;

$a = new Test();

$a->testEnum( null );
$a->testEnum( "A" );
$a->testEnum( TestEnum::B );

===== Invokation ======
java -cp lib/resin.jar:. com.caucho.quercus.CliQuercus test.php

===== Output =====
Exception in thread "main" java.lang.IllegalArgumentException: No enum constant TestEnum.
    at java.lang.Enum.valueOf(Enum.java:236)
    at com.caucho.quercus.marshal.EnumMarshal.marshal(EnumMarshal.java:59)
    at com.caucho.quercus.env.JavaInvoker.callJavaMethod(JavaInvoker.java:748)
    at com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:684)
    at com.caucho.quercus.program.JavaClassDef.callMethod(JavaClassDef.java:661)
    at com.caucho.quercus.env.JavaValue.callMethod(JavaValue.java:327)
    at com.caucho.quercus.expr.AbstractMethodExpr.eval(AbstractMethodExpr.java:91)
    at com.caucho.quercus.expr.ObjectMethodExpr.eval(ObjectMethodExpr.java:97)
    at com.caucho.quercus.expr.Expr.evalTop(Expr.java:528)
    at com.caucho.quercus.statement.ExprStatement.execute(ExprStatement.java:67)
    at com.caucho.quercus.statement.BlockStatement.execute(BlockStatement.java:105)
    at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:414)
    at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:89)
    at com.caucho.quercus.env.Env.executePageTop(Env.java:4239)
    at com.caucho.quercus.env.Env.executeTop(Env.java:4182)
    at com.caucho.quercus.env.Env.execute(Env.java:4157)
    at com.caucho.quercus.Quercus.execute(Quercus.java:202)
    at com.caucho.quercus.Quercus.execute(Quercus.java:177)
    at com.caucho.quercus.CliQuercus.main(CliQuercus.java:63)

===== Expected Output =====
null
A
B

---------- Proposed Fix: -----------

Handle the null pointer / NullPointer in marshal Method in EnumMarshal.java (see attached file)
Additional Information
Attached Files  enum_marshalling.patch [^] (806 bytes) 08-21-12 10:44

- Relationships

- Notes
(0006015)
nam
08-23-12 15:10

php/0cs2
 

- Issue History
Date Modified Username Field Change
08-21-12 10:44 matthiasblaesing New Issue
08-21-12 10:44 matthiasblaesing File Added: enum_marshalling.patch
08-23-12 14:42 nam Status new => assigned
08-23-12 14:42 nam Assigned To  => nam
08-23-12 15:10 nam Status assigned => closed
08-23-12 15:10 nam Note Added: 0006015
08-23-12 15:10 nam Resolution open => fixed
08-23-12 15:10 nam Fixed in Version  => 4.0.31


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