Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001109 [Quercus] feature always 05-13-06 18:27 07-18-06 11:23
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.0.19
Summary 0001109: PHP-Java communication: access to complex structures.
Description I've been playing around with talking to a Java class from PHP code, and one thing I noticed immediately is that the Java-PHP interface doesn't deal with complex PHP types. It would be great if, for example, a Map returned by a Java method looked like an associative array to the PHP code. Likewise, a Collection should act like an array. That would allow much more idiomatic PHP code. The way JSTL EL handles collections and maps is kind of what I'm thinking.

More important, though, is the reverse. Right now, as far as I can tell, if the PHP code wants to pass a complex structure to the Java side, the Java code has to provide an interface to construct the structure piece by piece, because arguments other than primitives (and references to Java objects) can't be passed to Java code.

<?php
$x['y'] = 'z';
$javaObject->doSomething($x);
?>

results in a null argument to the doSomething() method in interpreted mode, and a NullPointerException inside Quercus once the PHP class is compiled.

It would be okay to just pass in a Quercus Value object, which the Java code could then navigate as needed. Better would be to auto-convert to an untyped Map or Collection (recursively, of course, to handle multidimensional arrays). Best of all would be auto-conversion that pays attention to the argument types in the target method, e.g.

public void doSomething(Map<String,Map<Integer,String>> arg, double[] list)

for a two-dimensional array of strings with an integer second dimension and a list of doubles.
Additional Information
Attached Files

- Relationships

- Notes
(0001412)
ferg
07-18-06 11:23

php/3cc-
 

- Issue History
Date Modified Username Field Change
05-13-06 18:27 koreth New Issue
07-18-06 11:23 ferg Note Added: 0001412
07-18-06 11:23 ferg Assigned To  => ferg
07-18-06 11:23 ferg Status new => closed
07-18-06 11:23 ferg Resolution open => fixed
07-18-06 11:23 ferg Fixed in Version  => 3.0.20


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