Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002272 [Quercus] block always 12-21-07 18:43 01-24-08 12:34
Reporter rvt View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.5 Product Version 3.1.3
  Product Build
Summary 0002272: X/Y location of pressed area on form type image is incorrectly passed to the _POST variable
Description Wen using this input form type :
<input type="image" src="image.gif" name="sub" />

We should get in the $_POST variable the following coordinates:
$x = $_POST['sub_x'];
$y = $_POST['sub_y'];

However in quercus they are retreived as (according to W3C correctly):
$x = $_POST['sub.x'];
$y = $_POST['sub.y'];

So basically Quercus does it correctly, and PHP does internally convert the . to an _.

The proper solution would be to convert the . to an _ on incoming form variables.

Ries

thanks,
Ries
Steps To Reproduce
Additional Information According to : W3C http://www.w3.org/TR/html4/interact/forms.html [^]
According to PHP: http://www.php.net/variables.external [^] (section IMAGE SUBMIT variable names)
Attached Files

- Relationships

- Notes
(0002596)
rvt
12-21-07 19:08

To explain a bit better I made a example how to test this:

<?php
print '<form action="formtest.php" method="post" enctype="multipart/form-data" name="editform">';
print '<input type="image" src="http://www.rvantwisk.nl/typo3temp/pics/4341200a6d.jpg" [^] name="location" />';
print '</form>';
var_dump($_POST);
 ?>

mod_php:
array(2) { ["location_x"]=> string(2) "37" ["location_y"]=> string(2) "12" }

Quercus:
array(2) { ["location.x"]=> string(2) "37" ["location.y"]=> string(2) "12" }
 
(0002661)
rvt
01-18-08 20:23
edited on: 01-18-08 20:25

I hate to admit, but I made a mistake, this is a new patch:

Index: modules/quercus/src/com/caucho/quercus/env/Post.java
===================================================================
--- modules/quercus/src/com/caucho/quercus/env/Post.java (revision 3660)
+++ modules/quercus/src/com/caucho/quercus/env/Post.java (working copy)
@@ -290,7 +290,7 @@
 
       if (p > 0) {
        key = key.substring(0, p);
-
+ key = key.replace('.', '_');
        keyValue = env.createString(key);
        existingValue = array.get(keyValue);
 
@@ -361,6 +361,11 @@
         put(array, env.createString(index), formValue, addSlashesToValues);
     }
     else {
+ if (p>0) {
+ key = key.substring(0, p).replace('.','_') + "_" + key.substring(p+1, key.length());
+ } else {
+ key = key.replace('.', '_');
+ }
       put(array, env.createString(key), formValue, addSlashesToValues);
     }
   }


The reason behind this is that php will replace the . for a _ always before a [ is found, and when only a open bracket is found but not a closing bracket then teh open bracket will be replaced for an _.

print '<input type="text" name="T[f.p][t_b.c]" value="root">';
print '<input type="text" name="T[s.x][a.b_c]" value="12">';
print '<input type="text" name="ries2.y" value="12">';
print '<input type="text" name="ries2.q" value="12">';
print '<input type="text" name="a.b.c[[[[d" value="12">';
print '<input type="text" name="a.b.c]]]]d" value="12">';
print '<input type="text" name="q.b.c.[[[d" value="12">';
print '<input type="text" name="my.var[array.var" value="12">';
print '<input type="text" name="my.var.test[array.var.test" value="12">';

array(10) {
  ["T"]=>
  array(2) {
    ["f.p"]=>
    array(1) {
      ["t_b.c"]=>
      string(4) "root"
    }
    ["s.x"]=>
    array(1) {
      ["a.b_c"]=>
      string(2) "12"
    }
  }
  ["ries2_y"]=>
  string(2) "12"
  ["ries2_q"]=>
  string(2) "12"
  ["a_b_c_[[[d"]=>
  string(2) "12"
  ["a_b_c]]]]d"]=>
  string(2) "12"
  ["q_b_c__[[d"]=>
  string(2) "12"
  ["my_var_array.var"]=>
  string(2) "12"
  ["my_var_test_array.var.test"]=>
  string(2) "12"
}

 
(0002680)
nam
01-24-08 12:34

php/081h
php/081i
 

- Issue History
Date Modified Username Field Change
12-21-07 18:43 rvt New Issue
12-21-07 18:43 rvt Issue Monitored: rvt
12-21-07 19:08 rvt Note Added: 0002596
01-09-08 07:36 rvt Note Added: 0002635
01-18-08 20:23 rvt Note Added: 0002661
01-18-08 20:25 rvt Note Edited: 0002661
01-21-08 13:05 rvt Note Deleted: 0002635
01-24-08 11:31 nam Status new => assigned
01-24-08 11:31 nam Assigned To  => nam
01-24-08 12:34 nam Status assigned => closed
01-24-08 12:34 nam Note Added: 0002680
01-24-08 12:34 nam Resolution open => fixed
01-24-08 12:34 nam Fixed in Version  => 3.1.5


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
37 total queries executed.
28 unique queries executed.
Powered by Mantis Bugtracker