Mantis - Quercus
Viewing Issue Advanced Details
1231 minor always 07-05-06 17:00 07-15-06 10:38
koreth  
nam  
normal  
closed 3.0.20  
fixed  
none    
none 3.0.20  
0001231: is_subclass_of throws NullPointerException
PHP:

<?php
if (! is_subclass_of(true, "foobar")) {
    print "boolean is not a foobar\n";
}
?>

This throws a NullPointerException in Quercus and works fine in standalone PHP. (Might happen with types other than boolean too, but that's what caused the exception in my actual code.)

Notes
(0001397)
koreth   
07-13-06 22:20   
A simple patch that appears to fix the problem:

--- modules/quercus/src/com/caucho/quercus/lib/ClassesModule.java (revision 1255)
+++ modules/quercus/src/com/caucho/quercus/lib/ClassesModule.java (working copy)
@@ -140,7 +140,7 @@
     else
       cl = value.getQuercusClass();
 
- if (cl.getName().equalsIgnoreCase(name))
+ if (cl == null || cl.getName().equalsIgnoreCase(name))
       return false;
     else
       return cl.isA(name);
(0001400)
nam   
07-14-06 17:02   
php/1j0c (issue resolved)