Development

#4197 (sfBrowser parseArgumentAsArray function discards array indices == 0)

You must first sign up to be able to contribute.

Ticket #4197 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

sfBrowser parseArgumentAsArray function discards array indices == 0

Reported by: dlane Assigned to: fabien
Priority: minor Milestone: 1.0.18
Component: other Version: 1.0.18
Keywords: Cc:
Qualification: Unreviewed

Description

When creating tests using sfBrowser, I've tried using setField() to set values in forms where part of the field name includes [0]. This doesn't work due to the use of array_filter in the parseArgumentAsArray function (line 440 in /lib/symfony/utils/sfBrowser.class.php); array_filter is evaluating 0 to be equal to false.

For example:
$browser->setField('my_item[0][name]', 'My First Item'); // does not work.
$browser->setField('my_item[1][name', 'My Second Item'); // does work.

Instead of using array_filter to discard empty index values retrieved from preg_split (also line 440), add a check for strlen($tmp) > 0 in the following foreach statement (line 442). It produces the same effect, but allows you to use [0] array indices.

Attachments

sfBrowser.class.php (14.3 kB) - added by dlane on 08/13/08 17:56:26.
Corrected sfBrowser's parseArgumentAsArray function.

Change History

08/13/08 17:56:26 changed by dlane

  • attachment sfBrowser.class.php added.

Corrected sfBrowser's parseArgumentAsArray function.

08/19/08 16:42:07 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [10950]) [1.0, 1.1, 1.2] fixed sfBrowser parseArgumentAsArray function discards array indices == 0 (closes #4197)

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.