Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001998 [Quercus] crash sometimes 09-10-07 04:12 09-12-07 12:25
Reporter hendler View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 3.1.2
Summary 0001998: json_encode crashes encoding array
Description


The native Java type is a Hashtable [] where Hashtable is <String,String> .

print_r() works fine in the php env and yields

Array
(
    [0] => Array
        (
            [label] => national
            [property_label] => Scope
        )


Additional Information java.lang.UnsupportedOperationException
    at com.caucho.quercus.env.JavaAdapter.keySet(JavaAdapter.java:442)
    at com.caucho.quercus.lib.json.JsonModule.encodeArray(JsonModule.java:103)
    at com.caucho.quercus.lib.json.JsonModule.jsonEncodeImpl(JsonModule.java:87)
    at com.caucho.quercus.lib.json.JsonModule.encodeArray(JsonModule.java:117)
    at com.caucho.quercus.lib.json.JsonModule.jsonEncodeImpl(JsonModule.java:87)
    at com.caucho.quercus.lib.json.JsonModule.json_encode(JsonModule.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:105)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:613)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:486)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:472)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:182)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
    at com.caucho.quercus.env.JavaInvoker.evalArguments(JavaInvoker.java:416)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:170)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
    at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
    at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
    at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
    at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:239)
    at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:61)
    at com.caucho.quercus.page.QuercusPage.executeTop(QuercusPage.java:119)
    at com.caucho.quercus.servlet.ResinQuercusServlet.service(ResinQuercusServlet.java:123)
    at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:350)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:175)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:240)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:481)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:685)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:607)
    at java.lang.Thread.run(Thread.java:613)
Attached Files

- Relationships

- Notes
(0002286)
hendler
09-10-07 04:28

By simply rehashing the array in the php env, I have a workaround, and no error occurs.

function prep_json($args){
      if(is_array($args)){
           $return_array = array();
        foreach($args as $key=>$value){
          $return_array[$key] = prep_json($value);
        }
        return $return_array;
      } else {
        return $args;
      }
 }
 
(0002290)
nam
09-12-07 12:25

php/0cf0
php/3cf0
 

- Issue History
Date Modified Username Field Change
09-10-07 04:12 hendler New Issue
09-10-07 04:28 hendler Note Added: 0002286
09-12-07 12:01 nam Status new => assigned
09-12-07 12:01 nam Assigned To  => nam
09-12-07 12:25 nam Status assigned => closed
09-12-07 12:25 nam Note Added: 0002290
09-12-07 12:25 nam Resolution open => fixed
09-12-07 12:25 nam Fixed in Version  => 3.1.3


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