Bad code generated in onLoad

I have the following code as part of my onLoad event.

if (isset($addThis[‘skid_tag_num’])) {
//YES-then we want to to to the detail add with our information
$skid_tag_num=$addThis[‘skid_tag_num’];
unset($addThis[‘skid_tag_num’]); //Just to avoid confusion
$parm=serialize($addThis);
$addThis[‘cust’]=$parm.$skid_tag_num;
sc_redir(“Skid_Tag_Detail_Add”, addthisone=$parm;this_skid_tag=$skid_tag_num);
}

And I have been trying to figure out why the $skid_tag_num that got passed to the application was empty.

I finally looked at the generated code:

2262| if (isset($addThis[‘skid_tag_num’])) {
2263|
2264| $skid_tag_num=$addThis[‘skid_tag_num’];
2265| unset($addThis[‘skid_tag_num’]);
2266| $parm=serialize($addThis);
2267| $addThis[‘cust’]=$parm.$this->skid_tag_num;
2268| if (isset($this->sc_temp_addthisone)) { $_SESSION[‘addthisone’] = $this->sc_temp_addthisone;}
2269| if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
2270| {
2271| $this->nmgp_redireciona_form($this->Ini->path_link . “Skid_Tag_Detail_Add/Skid_Tag_Detail_Add.php”, $this->nm_location, “addthisone?#?” . $parm . “?@?” . “this_skid_tag?#?” . $this->skid_tag_num . “?@?”, “_self”, “ret_self”, 440, 630);
2272| };
2273| }

Note in line 2264 $skid_tag_num is set as a local variable. But in line 2267 it is referenced as $this->skid_tag_num.

THESE ARE TWO DIFFERENT VARIABLES…

Don’t know why exists exactly 2 same posts from different users with more than a year of difference… but well http://www.scriptcase.net/forum/showthread.php?4198-Bad-code-generated-in-onLoad&highlight=bad+code+generated

EDITED::