Anonymous | Login | Signup for a new account | 11-22-2024 03:57 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Advanced Details [ Jump to Notes ] | [ View Simple ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0004767 | [Quercus] | block | always | 09-18-11 15:09 | 09-21-11 08:37 | |||||||
Reporter | krystian | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | Platform | ||||||||
Status | new | OS | ||||||||||
Projection | none | OS Version | ||||||||||
ETA | none | Fixed in Version | Product Version | 4.0.14 | ||||||||
Product Build | ||||||||||||
Summary | 0004767: Array cookies are not read properly | |||||||||||
Description |
Reading a cookie like name[index] doesn't work in Resin/Quercus. When sending a cookie name[index] instead of being processed and put into array variable using index to set the value, a variable named 'name[index]' is set the value. It should behave as described in http://php.net/manual/en/language.variables.external.php#language.variables.external.cookies [^] and http://php.net/manual/en/function.setcookie.php#example-3780 [^] (about reading cookies). It seems that the place where the functionality is missed is http://www.caucho.com/resin-4.0-javadoc/com/caucho/quercus/env/Env.html#getCookies%28%29 [^] method, which doesn't distinguish cookies whose names contain square brackets, so it does not treat them as arrays, but just as normal (flat) variables. |
|||||||||||
Steps To Reproduce | ||||||||||||
Additional Information | In fact it happens in 4.0.19+ | |||||||||||
Attached Files | issue0004767.patch [^] (2,818 bytes) 09-21-11 08:37 | |||||||||||
|
Notes | |
(0005511) krystian 09-18-11 15:13 |
You might check this behaviour comparing Resin/Quercus and normal/standard PHP by using this PHP script on server-side: <?php $name = 'ARRAY-COOKIE-TEST'; $arrayIdx = 31337; if(array_key_exists($name, $_COOKIE) && array_key_exists($arrayIdx, $_COOKIE[$name])) { echo "behaving like normal PHP"; } if(array_key_exists($name.'['.$arrayIdx.']', $_COOKIE)) { echo "behaving like Resin"; } ?> and sending HTTP request to this script and setting required cookie - as in this example: private static final String COOKIE_NAME = "ARRAY-COOKIE-TEST"; private static final int ARRAY_INDEX = 31337; private static final String COOKIE_VALUE = "test-value"; @Test public void testTracker() throws Exception { HttpClientParams params = new HttpClientParams(); HttpClient client = new HttpClient(params); HostConfiguration config = new HostConfiguration(); HttpHost host = new HttpHost("127.0.0.1", 80, Protocol.getProtocol("http")); config.setHost(host); client.setHostConfiguration(config); HttpMethod method = new GetMethod("/array-cookie-test.php"); method.addRequestHeader("Cookie", COOKIE_NAME + "[" + ARRAY_INDEX + "]=" + COOKIE_VALUE + "; expires=Fri, 29-Sep-2012 15:03:21 GMT; path=/"); client.executeMethod(method); System.out.println(method.getResponseBodyAsString()); } |
(0005517) krystian 09-19-11 14:17 |
One point to note - multidimensional arrays should be supported - http://www.developertutorials.com/tutorials/php/articlename-050526-1149/ [^] -> Storing Arrays |
(0005519) krystian 09-20-11 11:46 edited on: 09-20-11 11:47 |
Another update on cookies spec version and their interoperability between Java and other platforms/languages (I might be good to be aware of it - as Resin/Quercus is to be interoperable between Java and PHP worlds) - especially comments in: http://java.net/jira/browse/GLASSFISH-10850?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel [^] http://java.net/jira/browse/GLASSFISH-10945?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel [^] resulting in org.glassfish.web.rfc2109_cookie_names_enforced settings property in different implementations of javax.servlet.http.Cookie Worth mentioning is also a rather juicy discussion around Tomcat's approach to cookies in: https://issues.apache.org/bugzilla/show_bug.cgi?id=44679 [^] |
(0005522) krystian 09-21-11 08:37 |
Please find attached a patch which fixes the described issue. The patch has been made against the trunk version. I might be missing formatter settings in Eclipse (as the formatter_profile=_caucho in .settings doesn't seem to be available in your SVN's trunk), so I would need to ask you to reformat the code with your formatter settings just after applying the patch. Cheers, Krystian |
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
37 total queries executed. 28 unique queries executed. |