Re: Bug
Brought to you by:
iridium
From: Ray v. B. <r_v...@ho...> - 2002-02-24 07:53:35
|
> > I have seen similar texts. For example, take the next metar: > > > > EHEH 231555Z 27013KT 9999 FEW018 03/01 Q0996 BLU > > > > It doesn't specify any precipitation or other weather phenomena. > > Therefor, the $weather_str stays empty, leading to the missing text. > > Maybe this should be changed to omitting the entire line ('Current > > weather is .')? > >But if $weather_str is left as the empty string, then it shouldn't be >able to sneak 'Current weather is' into the report :-) $weather_str is >copied directly to the output, it's not prefixed with 'Current >weather' or anything like that. ...snip... if (isset($data['weather'])) { $weather_str = sprintf($strings['current_weather'], $data['weather']); } else { $weather_str = ''; } ...snip... At some point the script test the existence of $data['weather']. Alltough the string itself is empty, it has been set previously: Somewhere at the beginning of the process_metar() function. As you can see, some other strings are set as well: ...snip... $decoded_metar['temp_visibility_miles'] = ''; $cloud_layers = 0; $decoded_metar['remarks'] = ''; $decoded_metar['weather'] = ''; ...snip... I found this by temporary adding two printf lines in the first snippet above. It shows that the isset() function finds that the the 'weather' string has been set (empty). This results in printing the 'Current weather is .' line. Greetz, Ray _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |