Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003898 [Quercus] minor always 02-20-10 13:28 03-01-13 00:26
Reporter syndetic View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 4.0.3
Summary 0003898: Quercus PHP does not understand Java enums
Description A PHP script running atop the Quercus engine does not appear to be able to properly understand Java enums.

Example:

== Java ================
public class Foo
{
   public enum Bar { BAZ, QUUX }
}
========================


== PHP =================
import Foo;
foreach(Foo->Bar AS $bar) { echo $bar; } // doesn't work
foreach(Foo::Bar AS $bar) { ... } // doesn't work
foreach(Foo->Bar->values() AS $bar) { ... } // doesn't work
$foo = new Foo();
foreach($foo->Bar AS $bar) { ... } // doesn't work
foreach($foo::Bar AS $bar) { ... } // doesn't work
import Foo->Bar; // no
import Foo::Bar; // still no
echo Foo->Bar->BAZ; // no
echo Foo->Bar::BAZ; // no
echo Foo::Bar->BAZ; // no
========================

Unless my syntax is incorrect, Quercus does not know how to loop over enum values. Depending on how the enum is accessed, sometimes Quercus evaluates the enum itself as a unicode string, which is also wrong. I tried going into the source to find out how it's doing its parsing, but it was just way too much to go through.

Please either indicate the correct way to loop over enum members or else put up a patch somewhere.
Additional Information
Attached Files

- Relationships

- Notes
(0004468)
jgritman
03-14-10 12:59

I've reproduced this issue as well. I'm trying to prototype Quercus integration with the neo4j graph db but am unable to proceed due to this bug.
 
(0006231)
nam
03-01-13 00:26

php/0cs3
Fixed for 4.0.36.

Java
------------------------------------------
package test;

public class Foo
{
  public enum MyEnum
  {
    A;
    
    public String test()
    {
      return "bar";
    }
  }
}


PHP
------------------------------------------
<?php

import test.Foo;

$a = Foo::MyEnum::A;
var_dump($a);

// note: you'll need to call Enum.values() to get the iterator,
// Quercus currently doesn't automatically call it for you
foreach (Foo::MyEnum->values() as $e) {
  var_dump($e);
}

?>
 

- Issue History
Date Modified Username Field Change
02-20-10 13:28 syndetic New Issue
03-14-10 12:59 jgritman Note Added: 0004468
03-01-13 00:19 nam Status new => assigned
03-01-13 00:19 nam Assigned To  => nam
03-01-13 00:26 nam Status assigned => closed
03-01-13 00:26 nam Note Added: 0006231
03-01-13 00:26 nam Resolution open => fixed
03-01-13 00:26 nam Fixed in Version  => 4.0.36


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