PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm » Bug #2530

strtotime error in HTML/QuickForm/date.php

Details

Submitted2004-10-14 15:34 UTC
Fromfizz at beyond dot hjsoft dot com
Assignedavb
StatusClosed
PackageHTML_QuickForm
PHP Version5.0.2
OSFedora Core 1
Roadmaps(Not assigned)

Comments

[2004-10-14 15:34 UTC] fizz at beyond dot hjsoft dot com

Description:
------------
On pages that use QuickForm date field type and PHP 5.0.2
it produces a warning as follows:

Warning: strtotime() [function.strtotime]: Called with an
empty time parameter.
in /usr/share/pear/HTML/QuickForm/date.php on line 385

a simple fix is add the following two lines prior to the
strtotime call (on line 385).

if ($value == NULL)
$value = "now";

effectively setting the default value to today if none is
set.

Expected result:
----------------
No warning message.

Actual result:
--------------
Warning: strtotime() [function.strtotime]: Called with an
empty time parameter.
in /usr/share/pear/HTML/QuickForm/date.php on line 387

[2004-10-14 18:27 UTC] fizz at beyond dot hjsoft dot com

This is the code that caused it.

$date = &$this->addElement('date', 'billing_month',
'Billing Month', array('format' => 'FY', 'minYear' =>
2004, 'maxYear' => date("Y")));
$date->setValue($billing_timestamp);

where $billing_timestamp is not set (so effectively NULL).