Development

#4193 (sfWidgetFormDate displays empty values for negative timestamps)

You must first sign up to be able to contribute.

Ticket #4193 (closed defect: fixed)

Opened 11 months ago

Last modified 10 months ago

sfWidgetFormDate displays empty values for negative timestamps

Reported by: maro Assigned to: fabien
Priority: major Milestone: 1.1.2
Component: form Version: 1.1.1
Keywords: sfWidgetFormDate, negative timestamp Cc:
Qualification: Unreviewed

Description

The sfWidgetFormDate widget does not display any value for dates before 1970-01-01 that results in a negative timestamp. The reason for that is the usage of the ctype_digit function in the sfWidgetFormDate::render() method:

$value = ctype_digit($value) ? (integer) $value : strtotime($value);

ctype_digit() returns false for negative integer (strings).

Example:

<?php
var_dump(date('Y-m-d', -783738000));
var_dump(ctype_digit(-783738000));
var_dump(strtotime(-783738000));
?>

I'm not sure but this could work better:

$value = (string)$value == (string)(int)$value ? (int)$value : strtotime($value);

Change History

09/11/08 16:26:13 changed by tklausing

  • version changed from 1.1.0 to 1.1.1.

I second that bug, it is still present in 1.1.1, and it's terribly annoying

Is there a reason this bug is still not fixed in SVN? (neither in 1.1 nor in 1.2 branch)

09/11/08 17:13:43 changed by fabien

  • milestone set to 1.1.2.

09/11/08 17:13:46 changed by fabien

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

(In [11446]) [1.1, 1.2] fixed sfWidgetFormDate displays empty values for negative timestamps (closes #4193)

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.