From:             bjdouma at xs4all dot nl
Operating system: Linux 2.6.7
PHP version:      5.0.0
PHP Bug Type:     Date/time related
Bug description:  NaN in php_sunrise_sunset()

Description:
------------
Good morning,

Re. php-5.0.0   

I noticed in sunfuncs.c/php_sunrise_sunset() there's this commented out
snippet:

  /* XXX: What's the use of this block.. ?
   * if (!calc_sunset && cosH > 1 || calc_sunset && cosH < -1) {
   *    throw doesnthappen(); 
   * }
   */ 

What the 'if' clause actually would detect is cases where you have no
sunrise or sunset, i.e. during the midnight sun period, on the Northern
hemisphere around June 21st, above ca. 66.5 deg latitude.        

For instance, try:

        php_sunrise_sunset( 182, 66, 0, 90.83, 0 );

this should give a good value for sunrise, very early in the morning.

Now try
       
        php_sunrise_sunset( 182, 67, 0, 90.83, 0 );

this should give NaN.

The reason is obvious: above ca. 66.56 deg latitude in the summer (here
day 182) you have the midnight sun period: the sun doesn't set and/or
rise.

However, this function isn't used anywhere -- is it?

--bjd

[EMAIL PROTECTED]



-- 
Edit bug report at http://bugs.php.net/?id=29205&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29205&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29205&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29205&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29205&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29205&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29205&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29205&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29205&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29205&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29205&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29205&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29205&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29205&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29205&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29205&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29205&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29205&r=float

Reply via email to