From:             ache at nagual dot pp dot ru
Operating system: FreeBSD
PHP version:      5.1.4
PHP Bug Type:     Date/time related
Bug description:  date_sunrise() date_sunset() handle main zone offset but not 
count summer time

Description:
------------
In php_date.c I see some (unsuccessful) effort to calculate proper offset,
I mean line

gmt_offset = timelib_get_current_offset(t) / 3600;

but it gets only _main_ zone offset, without current summer time added.
I.e. for Europe/Moscow it _always_ gets 3, but in the summer it must be
4.

This code can't work in any case, because it consider 'time' argument only
few lines later: 

timelib_unixtime2local(t, time);

but at the moment timelib_get_current_offset(t) called, 'time' arg simple
unused, so you can't get summer offset this way, only main one.

Please fix the code to count summer time too,

Reproduce code:
---------------
I have following lines in my php.ini:
date.default_latitude=55.75
date.default_longitude=37.61
date.timezone=Europe/Moscow

and call this test script when summer time (+0400) is active:
<?php
echo date("r").', '.date_sunrise(time()).', '.date_sunset(time());
echo date("r").',
'.date_sunrise(time(),SUNFUNCS_RET_STRING,55.75,37.61,90.583333,4).',
'.date_sunset(time(),SUNFUNCS_RET_STRING,55.75,37.61,90.583333,4);
?>

Expected result:
----------------
Two echo calls must produce the same sunrise/sunset results when summer
Moscow time (GMT+4, specified directly in the second echo call) is active.

Actual result:
--------------
Sunset/sunrise time of the first echo is one hour behind (GMT+3), when
script called with summer time active. 
date() call itself reports +0400 properly.
Moreover, I consult astronomical tables, first sunrise/sunset is
definitely one hour behind.

-- 
Edit bug report at http://bugs.php.net/?id=37358&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37358&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37358&r=trysnapshot51
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37358&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37358&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37358&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37358&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37358&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37358&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37358&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37358&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37358&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37358&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37358&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37358&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37358&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37358&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37358&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37358&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37358&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37358&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37358&r=mysqlcfg

Reply via email to