Author: fabien
Date: 2010-03-23 13:02:01 +0100 (Tue, 23 Mar 2010)
New Revision: 28702

Modified:
   branches/1.3/lib/util/sfBrowserBase.class.php
   branches/1.3/test/unit/util/sfBrowserTest.php
   branches/1.4/lib/util/sfBrowserBase.class.php
   branches/1.4/test/unit/util/sfBrowserTest.php
Log:
[1.3, 1.4] fixed browser to match more closely the behavior of a real browser 
(closes #7816)

Modified: branches/1.3/lib/util/sfBrowserBase.class.php
===================================================================
--- branches/1.3/lib/util/sfBrowserBase.class.php       2010-03-23 12:00:24 UTC 
(rev 28701)
+++ branches/1.3/lib/util/sfBrowserBase.class.php       2010-03-23 12:02:01 UTC 
(rev 28702)
@@ -927,7 +927,7 @@
       {
         $var = &$var[$tmp];
       }
-      if ($var)
+      if ($var && '[]' === substr($name, -2))
       {
         if (!is_array($var))
         {

Modified: branches/1.3/test/unit/util/sfBrowserTest.php
===================================================================
--- branches/1.3/test/unit/util/sfBrowserTest.php       2010-03-23 12:00:24 UTC 
(rev 28701)
+++ branches/1.3/test/unit/util/sfBrowserTest.php       2010-03-23 12:02:01 UTC 
(rev 28702)
@@ -10,7 +10,7 @@
 
 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
 
-$t = new lime_test(71);
+$t = new lime_test(73);
 
 // ->click()
 $t->diag('->click()');
@@ -117,6 +117,16 @@
       </span></div>
     </form>
 
+    <form action="/myform6" method="post">
+      <div><span>
+        <input type="text" name="foo[bar]" value="foo" />
+        <input type="text" name="foo[bar]" value="bar" />
+        <input type="text" name="bar" value="foo" />
+        <input type="text" name="bar" value="bar" />
+        <input type="submit" name="submit" value="submit6" />
+      </span></div>
+    </form>
+
     <a href="/myotherlink">test link</a>
     <a href="/submitlink">submit</a>
     <a href="/submitimagelink"><img src="myimage.gif" alt="submit" /></a>
@@ -329,3 +339,9 @@
 
 $t->is($files['myfile']['error'], UPLOAD_ERR_OK, 'existent file exists 
(UPLOAD_ERR_OK)');
 $t->is($files['myfile']['name'], basename($existentFilename), 'name key ok');
+
+// bug #7816
+$t->diag('bug #7816');
+list($method, $uri, $parameters) = $b->click('submit6');
+$t->is($parameters['bar'], 'bar', '->click() overrides input elements defined 
several times');
+$t->is($parameters['foo']['bar'], 'bar', '->click() overrides input elements 
defined several times');

Modified: branches/1.4/lib/util/sfBrowserBase.class.php
===================================================================
--- branches/1.4/lib/util/sfBrowserBase.class.php       2010-03-23 12:00:24 UTC 
(rev 28701)
+++ branches/1.4/lib/util/sfBrowserBase.class.php       2010-03-23 12:02:01 UTC 
(rev 28702)
@@ -927,7 +927,7 @@
       {
         $var = &$var[$tmp];
       }
-      if ($var)
+      if ($var && '[]' === substr($name, -2))
       {
         if (!is_array($var))
         {

Modified: branches/1.4/test/unit/util/sfBrowserTest.php
===================================================================
--- branches/1.4/test/unit/util/sfBrowserTest.php       2010-03-23 12:00:24 UTC 
(rev 28701)
+++ branches/1.4/test/unit/util/sfBrowserTest.php       2010-03-23 12:02:01 UTC 
(rev 28702)
@@ -10,7 +10,7 @@
 
 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
 
-$t = new lime_test(71);
+$t = new lime_test(73);
 
 // ->click()
 $t->diag('->click()');
@@ -117,6 +117,16 @@
       </span></div>
     </form>
 
+    <form action="/myform6" method="post">
+      <div><span>
+        <input type="text" name="foo[bar]" value="foo" />
+        <input type="text" name="foo[bar]" value="bar" />
+        <input type="text" name="bar" value="foo" />
+        <input type="text" name="bar" value="bar" />
+        <input type="submit" name="submit" value="submit6" />
+      </span></div>
+    </form>
+
     <a href="/myotherlink">test link</a>
     <a href="/submitlink">submit</a>
     <a href="/submitimagelink"><img src="myimage.gif" alt="submit" /></a>
@@ -329,3 +339,9 @@
 
 $t->is($files['myfile']['error'], UPLOAD_ERR_OK, 'existent file exists 
(UPLOAD_ERR_OK)');
 $t->is($files['myfile']['name'], basename($existentFilename), 'name key ok');
+
+// bug #7816
+$t->diag('bug #7816');
+list($method, $uri, $parameters) = $b->click('submit6');
+$t->is($parameters['bar'], 'bar', '->click() overrides input elements defined 
several times');
+$t->is($parameters['foo']['bar'], 'bar', '->click() overrides input elements 
defined several times');

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to