Mantis - Quercus
Viewing Issue Advanced Details
4056 major sometimes 05-28-10 15:26 05-28-10 15:26
sblommers Linux  
Ubuntu  
normal 10.04  
new 4.0.7  
SVN (latest) open  
none    
none  
0004056: Env.getCookies crashing on _request (nullpointer exception) when in scriptcontext mode (JSR)
Running Drupal 6.16 functions in SC mode (running node_load etc from script).
Sometimes Env.getCookies is called but in this SC the request and session variables are null (not initialized). I don't know if I'm doing something wrong here but I created a patch for it to not make it crash.
Get cookies in php script when there is no servlet serving the php files but a QuercusEngine or using javax.script ..
DIFF against latest SVN 7166

diff -r 0c58513dd2cb modules/quercus/src/com/caucho/quercus/env/Env.java
--- a/modules/quercus/src/com/caucho/quercus/env/Env.java Fri May 28 11:54:18 2010 +0200
+++ b/modules/quercus/src/com/caucho/quercus/env/Env.java Sat May 29 00:21:19 2010 +0200
@@ -2641,6 +2641,9 @@
     ArrayValue array = new ArrayValueImpl();
     boolean isMagicQuotes = getIniBoolean("magic_quotes_gpc");
 
+ if(_request == null)
+ return array;
+
     Cookie []cookies = _request.getCookies();
     if (cookies != null) {
       for (int i = 0; i < cookies.length; i++) {

There are no notes attached to this issue.