[ phpweather-Bugs-951022 ] No initialization of $metar_time
Brought to you by:
iridium
From: SourceForge.net <no...@so...> - 2004-05-10 09:00:42
|
Bugs item #951022, was opened at 2004-05-10 04:12 Message generated for change (Comment added) made by gimpster You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377952&aid=951022&group_id=23245 Category: None >Group: None >Status: Closed Priority: 5 Submitted By: Manuel Serra (manu11) Assigned to: Nobody/Anonymous (nobody) >Summary: No initialization of $metar_time Initial Comment: Hi, I'm not sure if i'm posting in the right place. I installed phpweather and it is working with MySQL db. The only problem is when i get a METAR with no data, i receive an error: Notice: Undefined variable: metar_time in /home/wwwfly/public_html/metars/data_retrieval.php on line 430 Notice: Undefined variable: metar_time in /home/wwwfly/public_html/metars/data_retrieval.php on line 434 Warning: Cannot modify header information - headers already sent by (output started at /home/wwwfly/public_html/metars/data_retrieval.php: 430) in /home/wwwfly/public_html/metars/index.php on line 121 How can i correct this? Thanks ---------------------------------------------------------------------- >Comment By: Martin Geisler (gimpster) Date: 2004-05-10 11:00 Message: Logged In: YES user_id=104098 You're in the right place --- you've found a bug :-) Thanks for the report, I've explained how you can fix it below. Add a line that says $metar_time = 0; on line 420, so that this section now looks like this: } else { /* If we end up here, it means that there was no file. If the * station was a new station, we set the metar to an empty * string, else we just use the old METAR. We adjust the time * stored in the database in both cases, so that the server * isn't stressed too much. */ if ($new_station) { $metar = ''; } else { $metar = $this->metar; } $timestamp = time() - $this->properties['cache_timeout'] + 600; $metar_time = 0; // <-- The new line. } /* We then cache the METAR in our database */ if ($new_station) { $this->debug('get_metar_from_web(): Inserting new METAR for <code>' . $this->get_location() . '</code>'); $this->db->insert_metar($icao, $metar, $timestamp, $metar_time); } else { $this->debug('get_metar_from_web(): Updating METAR for <code>' . $this->get_location() . '</code>'); $this->db->update_metar($icao, $metar, $timestamp, $metar_time); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377952&aid=951022&group_id=23245 |