Re: silinging warnings?
| From: | Jon Parise | Date: | Sat, 28 Jun 2003 19:33:02 +0000 |
| Subject: | Re: silinging warnings? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17826@lists.php.net to get a copy of this message | ||
On Sat, Jun 28, 2003 at 12:08:08PM +0200, Lukas Smith wrote:
> Due to its simple nature it uses something like the following to convert
> form a unix timestamp to an MDB timestamp:
> function unix2Mdbstamp($unix_timestamp)
> {
> return date('Y-m-d H:i:s', $unix_timestamp);
> }
>
> This can lead to odd results if the unix timestamp is less than 0. I
> want to keep the code as simple as possible, because people can move to
> the PEAR::Date if they need anything more fancy.
In preferred order:
1. Alter the code to handle negative $unix_timestamp values.
2. Return an empty string if $unix_timestamp is negative.
3. Raise an assert / PEAR_Error if $unix_timestamp is negative.
4. Silence the data() warning.
Whatever option you choose, please document the behavior in the phpdoc
block for unix2Mdbstamp().
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)