#46670 [NEW]: date_sunrise (date_sunset) incorrectly works with gmtoffset parameter
| From: | andrewboltachev at gmail dot com | Date: | Tue, 25 Nov 2008 20:13:14 +0000 |
| Subject: | #46670 [NEW]: date_sunrise (date_sunset) incorrectly works with gmtoffset parameter | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-131322@lists.php.net to get a copy of this message | ||
From: andrewboltachev at gmail dot com
Operating system: UNIX
PHP version: 5.2.6
PHP Bug Type: Date/time related
Bug description: date_sunrise (date_sunset) incorrectly works with gmtoffset parameter
Description:
------------
date_sunrise (date_sunset) incorrectly works with gmtoffset parameter.
When i use SUNFUNCS_RET_TIMESTAMP, it ignores it and calculates date by
adding UTC sunrise date and my location offset. When use
SUNFUNCS_RET_STRING, all is ok. I don't checked SUNFUNCS_RET_DOUBLE.
Reproduce code:
---------------
<?php
$lat = 43.1167; $lng = 131.9; //Vladivostok, Russia, UTC+10
date_default_timezone_set('Europe/Moscow'); //My location timezone, UTC+3
$zenith = 90+50/60;
$offset = 10; //Vladivostok
$sunrise_str =
date_sunrise(time(),SUNFUNCS_RET_STRING,$lat,$lng,$zenith,$offset);
$sunrise_time = date_sunrise
(time(),SUNFUNCS_RET_TIMESTAMP,$lat,$lng,$zenith,$offset);
echo "By string : $sunrise_str, by timestamp: ".date("Y-m-d
H:i:s",$sunrise_time)."<br/>\n";
$offset = 0; //UTC
$sunrise_str =
date_sunrise(time(),SUNFUNCS_RET_STRING,$lat,$lng,$zenith,$offset);
$sunrise_time = date_sunrise
(time(),SUNFUNCS_RET_TIMESTAMP,$lat,$lng,$zenith,$offset);
echo "By string : $sunrise_str, by timestamp: ".date("Y-m-d
H:i:s",$sunrise_time)."<br/>\n";
$offset = 3; //UTC plus my timezone offset
$sunrise_str =
date_sunrise(time(),SUNFUNCS_RET_STRING,$lat,$lng,$zenith,$offset);
$sunrise_time = date_sunrise
(time(),SUNFUNCS_RET_TIMESTAMP,$lat,$lng,$zenith,$offset);
echo "By string : $sunrise_str, by timestamp: ".date("Y-m-d
H:i:s",$sunrise_time)."<br/>\n";
?>
Expected result:
----------------
By string : 08:16, by timestamp: 2008-11-25 08:16:18
By string : 22:16, by timestamp: 2008-11-24 22:16:18
By string : 01:16, by timestamp: 2008-11-25 01:16:18
Actual result:
--------------
By string : 08:16, by timestamp: 2008-11-25 01:16:18
By string : 22:16, by timestamp: 2008-11-25 01:16:18
By string : 01:16, by timestamp: 2008-11-25 01:16:18
--
Edit bug report at http://bugs.php.net/?id=46670&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46670&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46670&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46670&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46670&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46670&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46670&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46670&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46670&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46670&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46670&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46670&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46670&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46670&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46670&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46670&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46670&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46670&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46670&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46670&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46670&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46670&r=mysqlcfg