Re: silinging warnings?

From: Date: Wed, 02 Jul 2003 13:05:07 +0000
Subject: Re: silinging warnings?
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17927@lists.php.net to get a copy of this message
On Saturday, June 28, 2003 21:33, Jon Parise wrote: > 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(). Or do as John does in his Date class: if detect a negative timestamp, include_once 'Date.php' and use it for the calculations. -- Tomas V.V.Cox mailto:cox@idecnet.com

« previous php.pear.dev (#17927) next »