Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002362 [Quercus] major always 01-23-08 12:03 06-05-08 19:19
Reporter davidsklar View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.2.0 Product Version 3.1.5
  Product Build
Summary 0002362: When extending a built-in class (DOMXPath), parent constructor never gets called
Description Instantiating a class that extends DOMXPath doesn't work, because the parent constructor never gets called. This happens whether or not the child class explicitly calls the parent constructor.

Test case:

<?php

class Broken1 extends DOMXPath { }
class Broken2 extends DOMXPath { public function __construct($d) { parent::__construct($d); } }

$doc = new DOMDocument();
$doc->loadXml('<cake>chocolate</cake>');

$xpath = new DOMXPath($doc);
$broken1 = new Broken1($doc);
$broken2 = new Broken2($doc);

print "
\n";

print "DOMXPath:
\n";
print $xpath->query('/cake')->item(0)->textContent;
print "\n<hr/>\n";

print "Broken 1:
\n";
print $broken1->query('/cake')->item(0)->textContent;
print "\n<hr/>\n";

print "Broken 2:
\n";
print $broken2->query('/cake')->item(0)->textContent;
print "\n<hr/>\n";
?>

When run under Resin/Quercus 3.1.4 or 3.1.s080114, this produces the following results:

/home/david/quercus/resin-3.1.s080114/webapps/ROOT/inherit-test.php:10: Warning: function '__construct' has 1 required arguments, but only 0 were provided /home/david/quercus/resin-3.1.s080114/webapps/ROOT/inherit-test.php:11: Warning: function '__construct' has 1 required arguments, but only 0 were provided

DOMXPath:
chocolate

Broken 1:
500 Servlet Exception

com.caucho.quercus.QuercusException: com.caucho.quercus.lib.dom.DOMXPath.query:
null
    at com.caucho.quercus.env.JavaMethod.invoke(JavaMethod.java:104)
    at com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:604)
    at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
    at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
    at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:92)
    at com.caucho.quercus.expr.FieldGetExpr.eval(FieldGetExpr.java:72)
    at com.caucho.quercus.env.JavaInvoker.evalArguments(JavaInvoker.java:415)
    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.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:146)
    at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:353)
    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:181)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
    at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.NullPointerException
    at com.caucho.quercus.lib.dom.DOMXPath.query(DOMXPath.java:99)
    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.env.JavaMethod.invoke(JavaMethod.java:97)
    at com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:604)
    at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
    at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
    at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:92)
    at com.caucho.quercus.expr.FieldGetExpr.eval(FieldGetExpr.java:72)
    at com.caucho.quercus.env.JavaInvoker.evalArguments(JavaInvoker.java:415)
    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.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:146)
    at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:353)
    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:181)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
    at java.lang.Thread.run(Thread.java:613)


If you comment out the $broken1->query() line, then the same 500 error/NPE happens on the $broken2->query() line.

The expected result, run against PHP 5.2.3 is:



DOMXPath:

chocolate
<hr/>
Broken 1:

chocolate
<hr/>
Broken 2:

chocolate
<hr/>

Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0003146)
nam
06-05-08 19:19

php/0k3-
php/1z11
 

- Issue History
Date Modified Username Field Change
01-23-08 12:03 davidsklar New Issue
01-23-08 12:03 davidsklar Issue Monitored: davidsklar
06-05-08 11:31 nam Status new => assigned
06-05-08 11:31 nam Assigned To  => nam
06-05-08 19:19 nam Status assigned => closed
06-05-08 19:19 nam Note Added: 0003146
06-05-08 19:19 nam Resolution open => fixed
06-05-08 19:19 nam Fixed in Version  => 3.2.0


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