[PATCH] prevent time misrendering due to php bug#28717 [php4, pgsql]

Andreas Kohn andreas at syndrom23.de
Mon Mar 13 03:52:41 EST 2006


Hi,

My tinderbox web page (2.3.0 + www-exp, code looks the same for CVS head
though) displays garbage times for the latest_buildports page in the
duration column. I'm using php4-4.4.2_1 and postgresql-server-8.0.6.

The code path leading to the garbage:

templates/default/current_buildports.tpl calls
time_difference_from_now(then="YY-mm-dd HH:MM:SS.fff")

functions.php:time_difference_from_now uses strtotime() to convert that
"then" into a time.

strtotime() returns -1 on PHP 4, because the time string given contains
the fractional seconds part. This is a wontfix error for PHP 4:
http://bugs.php.net/bug.php?id=28717

The patch basically removes the fractional part, so that strtotime()
returns correct numbers, and the duration display displays correct
durations again.

Regards,
Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tb-webui-core-functions.php.diff
Type: text/x-patch
Size: 601 bytes
Desc: not available
Url : http://marcuscom.com/pipermail/tinderbox-list/attachments/20060313/f1a4f106/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://marcuscom.com/pipermail/tinderbox-list/attachments/20060313/f1a4f106/attachment-0001.bin 


More information about the tinderbox-list mailing list