Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001727 [Quercus] minor always 05-06-07 16:05 06-03-07 14:28
Reporter ybakos View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.1 Product Version 3.1.0
  Product Build
Summary 0001727: Wordpress blog view fails after install
Description An installation of Wordpress works ok, and things under wp-admin work fine too (one can create posts).

However, if you try to view the blog as a public user would, Quercus throws an arrayindexoutofboundsexception.
Steps To Reproduce
Additional Information 500 Servlet Exception

java.lang.ArrayIndexOutOfBoundsException: -1
    at com.caucho.quercus.lib.string.StringModule$LongPrintfSegment.apply(StringModule.java:4052)
    at com.caucho.quercus.lib.string.StringModule.sprintf(StringModule.java:1865)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    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:615)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:487)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:473)
    at com.caucho.quercus.env.JavaInvoker.callCopy(JavaInvoker.java:482)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:178)
    at com.caucho.quercus.expr.FunctionExpr.evalCopy(FunctionExpr.java:149)
    at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:77)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
    at com.caucho.quercus.program.ForeachStatement.execute(ForeachStatement.java:82)
    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.IfStatement.execute(IfStatement.java:75)
    at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
    at com.caucho.quercus.program.Function.callImpl(Function.java:316)
    at com.caucho.quercus.program.Function.call(Function.java:264)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:125)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    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.env.Env.include(Env.java:3137)
    at com.caucho.quercus.expr.IncludeOnceExpr.eval(IncludeOnceExpr.java:83)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:99)
    at com.caucho.quercus.program.Function.callImpl(Function.java:316)
    at com.caucho.quercus.program.Function.call(Function.java:264)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:125)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
    at com.caucho.quercus.program.Function.callImpl(Function.java:316)
    at com.caucho.quercus.program.Function.call(Function.java:264)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:125)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    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.env.Env.include(Env.java:3137)
    at com.caucho.quercus.expr.IncludeExpr.eval(IncludeExpr.java:86)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    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.IfStatement.execute(IfStatement.java:78)
    at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:78)
    at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:78)
    at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:78)
    at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:78)
    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.QuercusProgram.execute(QuercusProgram.java:239)
    at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:61)
    at com.caucho.quercus.env.Env.include(Env.java:3137)
    at com.caucho.quercus.expr.IncludeOnceExpr.eval(IncludeOnceExpr.java:83)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    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.QuercusProgram.execute(QuercusProgram.java:239)
    at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:61)
    at com.caucho.quercus.env.Env.include(Env.java:3137)
    at com.caucho.quercus.expr.IncludeExpr.eval(IncludeExpr.java:86)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:63)
    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:115)
    at com.caucho.quercus.servlet.ResinQuercusServlet.service(ResinQuercusServlet.java:122)
    at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:298)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
    at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:167)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:226)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:477)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:591)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:613)

Attached Files

- Relationships

- Notes
(0001897)
urubatan
05-07-07 12:42

I found the bug that causes this, it is a bug in the StringModule, more exactly in the class com.caucho.quercus.lib.string.StringModule.PrintfSegment.

the two methods that parse formated strings had little problems, I have changed both and now I have wordpress 2.1 running OK on quercus.

I do not know how to send a patch, since we do not have CVS access to the sources, so the fix is here:
remove the break in the method getIndex, it will look like this:
static int getIndex(String format)
{
int value = 0;
for (int i = 0; i <format.length(); i++) {
char ch;
if ('0' <= (ch = format.charAt(i)) && ch <= '9')
value = 10 * value + ch - '0';
}
return value - 1;
}

the original version had a problem parsing strings in the format: " %2$d"

change the expression parsing in the getIndexFormat method, that has a problem parsing the format above too.
static String getIndexFormat(String format)
{
//int p = format.indexOf('$');
return format.replaceAll("[0-9]*\\$", "");
}


after this corrections, I found an exception while listing the history of the blog, and found it to be caused by an unimplemented cmpObject method in the class com.caucho.quercus.env.ObjectValue, I have changed the method to return "0" instead of throwing an exception (it looks like this now)
public int cmpObject(ObjectValue rValue)
{
return 0;
//throw new Run timeException("not implemented");
}


and now I have the wordpress 2.1 fully functional with Tomcat 6 and Quercus.

I hope Caucho people can use this "patch" for the next version of Quercus, and if is there a way to get access to the CVS or SVN I can send a .patch file next time.

Thanks for the great software.
 
(0001898)
nam
05-07-07 15:06

I believe these issues have been resolved in 3.1.1. Please try 3.1.1 and let me know if you're still experiencing issues with Wordpress.
 
(0001899)
urubatan
05-07-07 15:51

the not implemented issue persists in the history or posts list of wordpress, here is the stack trace:
Caused by: com.caucho.quercus.QuercusExecutionException: java.lang.RuntimeException not implemented
    at com.caucho.quercus.env.ObjectValue.cmpObject(ObjectValue.java:100)
    at com.caucho.quercus.env.Value.cmp(Value.java:254)
    at com.caucho.quercus.env.Value.lt(Value.java:280)
    at com.caucho.quercus.env.ArrayValue$ValueComparator.compare(ArrayValue.java:1373)
    at com.caucho.quercus.lib.ArrayModule$CompareNormal.compare(ArrayModule.java:3378)
    at com.caucho.quercus.lib.ArrayModule$CompareNormal.compare(ArrayModule.java:3354)
    at java.util.Arrays.mergeSort(Arrays.java:1270)
    at java.util.Arrays.sort(Arrays.java:1210)
    at com.caucho.quercus.env.ArrayValue.sort(ArrayValue.java:789)
    at com.caucho.quercus.lib.ArrayModule.sort(ArrayModule.java:1504)
    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:597)
    at com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:105)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:614)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:487)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:473)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:125)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
    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.Function.callImpl(Function.java:316)
    at com.caucho.quercus.program.Function.callCopy(Function.java:269)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:178)
    at com.caucho.quercus.expr.FunctionExpr.evalCopy(FunctionExpr.java:149)
    at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:77)
    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.Function.callImpl(Function.java:316)
    at com.caucho.quercus.program.Function.call(Function.java:264)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:125)
    at com.caucho.quercus.program.EchoStatement.execute(EchoStatement.java:57)
    at com.caucho.quercus.program.Function.callImpl(Function.java:316)
    at com.caucho.quercus.program.Function.call(Function.java:264)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:180)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:125)
    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.WhileStatement.execute(WhileStatement.java:60)
    at .(/E:/Java/workspaces/connectait/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/blog/wp-content/themes/default/archive.php:34)


the instruction that started this was:
<?php while (have_posts()) : the_post(); ?>



I fixed this changing the line 100 of the file: com.caucho.quercus.env.ObjectValue.java from throw new RuntimeException("not implemented");
to "return 0"
and wordpress is working
 
(0001901)
ybakos
05-08-07 19:05

Hi nam, I confirm that these issues are now resolved with 3.1.1.
You are the friggin man. Thank you.
 
(0001914)
nam
05-15-07 09:20

I think objects comparison is not yet implemented. But I have analyzed the function have_posts() and it never compares objects. It is a quercus bug if it did. Therefore, I am reluctant to fix the "not implemented" exception because it would just mask the underlying problem.

urubatan, are you seeing the issue from a fresh install? What are the exact steps to reproduce it because I have been unable to reproduce this issue.
 

- Issue History
Date Modified Username Field Change
05-06-07 16:05 ybakos New Issue
05-07-07 12:42 urubatan Note Added: 0001897
05-07-07 15:04 nam Status new => assigned
05-07-07 15:04 nam Assigned To  => nam
05-07-07 15:06 nam Note Added: 0001898
05-07-07 15:06 nam Status assigned => feedback
05-07-07 15:51 urubatan Note Added: 0001899
05-08-07 19:05 ybakos Note Added: 0001901
05-15-07 09:20 nam Note Added: 0001914
06-03-07 14:28 sam Status feedback => closed
06-03-07 14:28 sam Resolution open => fixed
06-03-07 14:28 sam Fixed in Version  => 3.1.1


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