Howdy,
I noticed in my apache log file I was getting a lot of PHP Notices with undefined offsets. Not knowing PHP, I had to read up a little but I was able to squelch the errors by making some modifications to the `ajax-dashboard.php' file.
Below are the errors and subsequent is a `diff -u' to show the chances. I'm not sure if you'll want to push it to the main code path. If so, you should be able to feed the `diff -u' result to `patch'
Cheers,
-pablo
Errors in Apache Log file
[Sat May 02 15:58:24 2009] [error] [client ::1] PHP Notice: Undefined offset: 3 in /home/sites/weather/ajax-dashboard.php on line 811
[Sat May 02 15:58:25 2009] [error] [client ::1] PHP Notice: Undefined offset: 1 in /home/sites/weather/ajax-dashboard.php on line 797
[Sat May 02 15:58:25 2009] [error] [client ::1] PHP Notice: Undefined offset: 1 in /home/sites/weather/ajax-dashboard.php on line 809
[Sat May 02 15:58:25 2009] [error] [client ::1] PHP Notice: Undefined offset: 2 in /home/sites/weather/ajax-dashboard.php on line 810
[Sat May 02 15:58:25 2009] [error] [client ::1] PHP Notice: Undefined offset: 3 in /home/sites/weather/ajax-dashboard.php on line 811
`diff -u'
--- ajax-dashboard.php 2009-05-02 16:11:27.000000000 -0400
+++ /usr3/Backups/weather/www/ajax-dashboard.php 2009-04-30 17:54:15.000000000 -0400
@@ -764,15 +764,7 @@
//
function fixup_date ($WDdate) {
global $timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode;
-
- if ( strlen ($WDdate) == 0 ) {
- return ('');
- }
-
$d = split('/',$WDdate);
- if ( ! $d || (count ($d) < 4) ) { // split failed -or- not enough values
- return ('');
- }
if ($d[2] > 70 and $d[2] <= 99) {$d[2] += 1900;} // 2 digit dates 70-99 are 1970-1999
if ($d[2] < 99) {$d[2] += 2000; } // 2 digit dates (left) are assumed 20xx dates.
if ($WDdateMDY) {
@@ -793,8 +785,8 @@
// strip trailing units from a measurement
// i.e. '30.01 in. Hg' becomes '30.01'
function strip_units ($data) {
- $number_found=preg_match('/([\d\.\+\-]+)/',$data,$t);
- return $number_found == 0 ? '' : $t[1];
+ preg_match('/([\d\.\+\-]+)/',$data,$t);
+ return $t[1];
}
//=========================================================================
@@ -806,9 +798,9 @@
preg_match_all('|(\d+)|is',$WDmoonage,$matches);
// print "<!-- matches=\n" . print_r($matches,true) . "-->\n";
$mdays = $matches[1][0];
- $mhours = count($matches[1]) > 1 ? $matches[1][1] : '';
- $mmins = count($matches[1]) > 2 ? $matches[1][2] : '';
- $mpct = count($matches[1]) > 3 ? $matches[1][3] : '';
+ $mhours = $matches[1][1];
+ $mmins = $matches[1][2];
+ $mpct = $matches[1][3];
$mdaysd = $mdays + ($mhours / 24) + ($mmins / 1440);
// Definitions from http://www.answers.com/topic/lunar-phase