From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.15 ppc
PHP version:      4.0.6
PHP Bug Type:     Date/time related
Bug description:  strftime() doesn't grok negative time_t

This:

  echo strftime("%Y-%m-%d %H:%M:%S", -200000);

outputs an empty string. However, this:

  $foo = localtime(-200000000); echo $foo[5]+1900;

outputs "1963" in Linux 2.2.15, but outputs an empty string in Win2k. While
negative time_t is undefined according to POSIX, time functions should
probably work consistently, and strftime() should never output nothing.
(That is, since there is no error condition documented for strftime(),
this:

  echo strftime("HONK", -200000);

should /always/ output "HONK", even if the %-values end up empty because of
the undefined meaning of negative time values.)

So, either strftime with negative time values should work,
or localtime with negative time values should fail (and the rest of the
time functions made consistent with either decision). If it's decided that
negative time values are to cause the functions to fail, then error
conditions should probably be defined or documented for those functions
(and maybe even warnings?).

(To be clear, that's not "PHP is nonconforming", but rather "undocumented
and nonportable inconsistency amongst *time functions is a particularly
icky form of nasal demon".)

-- 
Edit bug report at: http://bugs.php.net/?id=12934&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to