Mantis - Quercus
Viewing Issue Advanced Details
1114 minor always 05-16-06 13:58 05-16-06 18:56
koreth  
ferg  
normal  
closed 3.0.20  
fixed  
none    
none 3.0.20  
0001114: Can't use socket as array index
PHP code:

<?php
$sock = fsockopen("www.sun.com", 80);
$foo[$sock] = 'x';
print $foo[$sock] . "\n";
?>

This outputs "x" on Zend PHP; Quercus throws an exception:

com.caucho.quercus.QuercusExecutionException: com.caucho.quercus.QuercusRuntimeException
ResourceValue[] is not a valid key
    at com.caucho.quercus.env.Value.toKey(Value.java:261)
    at com.caucho.quercus.env.ArrayValueImpl.createEntry(ArrayValueImpl.java:704)
    at com.caucho.quercus.env.ArrayValueImpl.put(ArrayValueImpl.java:307)
    at com.caucho.quercus.expr.ArrayGetExpr.evalAssign(ArrayGetExpr.java:190)
    at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:83)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:78)
    at .(/Users/sgrimm/resin/resin/webapps/test/test.php:3)

The PHP "memcached" client library uses sockets as array indexes (that's where the error is cropping up in my real code.)

Notes
(0001144)
ferg   
05-16-06 18:56   
php/1m0c