Mantis - Quercus
Viewing Issue Advanced Details
3176 major always 12-14-08 16:44 12-15-08 08:44
koreth  
ferg  
normal  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003176: $GLOBALS array elements cause NPE when accessed
<?php
function foo() {
  $GLOBALS['foo'] = array();
  $GLOBALS['foo']['bar'] = 'abc';
}
foo();

Dies with NPE on the latest Quercus code from svn.

[16:42:38.688] {http--8080-8} java.lang.NullPointerException
[16:42:38.688] {http--8080-8} at com.caucho.quercus.env.ArrayValueImpl.getArray(ArrayValueImpl.java:545)
[16:42:38.688] {http--8080-8} at com.caucho.quercus.env.Var.getArray(Var.java:1037)
[16:42:38.688] {http--8080-8} at com.caucho.quercus.expr.ArrayGetExpr.evalArray(ArrayGetExpr.java:115)
[16:42:38.688] {http--8080-8} at com.caucho.quercus.expr.ArrayGetGetExpr.evalAssign(ArrayGetGetExpr.java:60)
[16:42:38.688] {http--8080-8} at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:88)
[16:42:38.688] {http--8080-8} at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[16:42:38.688] {http--8080-8} at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:105)

Happens in both interpreted and compiled modes.

Notes
(0003634)
ferg   
12-15-08 08:44   
php/0880