[ADIF Parser] If EOH didn't exist, $i was never set. Init on declaration instead.

This commit is contained in:
Andreas
2023-01-22 15:14:00 +01:00
parent 2c40e9acad
commit f37da1aab5

View File

@@ -21,7 +21,7 @@ class ADIF_Parser
var $data; //the adif data
var $datasplit; // one entry is one QSO in the array
var $currentarray = 0; // current place in the array
var $i; //the iterator
var $i = 0; //the iterator
var $headers = array();
public function initialize() //this function locates the <EOH>
@@ -29,6 +29,11 @@ class ADIF_Parser
$pos = mb_stripos(mb_strtoupper($this->data, "UTF-8"), "<EOH>", 0, "UTF-8");
$in_tag = false;
$tag = "";
$value_length = "";
$value = "";
if($pos == false) //did we find the end of headers?
{
// Just skip if we did not find (optional) headers
@@ -36,14 +41,6 @@ class ADIF_Parser
goto noheaders;
};
//get headers
$this->i = 0;
$in_tag = false;
$tag = "";
$value_length = "";
$value = "";
while($this->i < $pos)
{
//skip comments