From: Jakub A. <jak...@se...> - 2003-02-15 20:07:02
|
Hi, someone broke my code in mail.php3, function send_mail_from_table. My own code was commented out and the function new_unalias_recurent was there instead. But the parameters to this function were all bad and it was not working in the cycle as it should and so on. Why? Who? Not that it was so much damage, I only deleted the changes and returned to my code. But it is strange because the changes were really so incorrect. Jakub This is the broken state: if (is_array ($aliases)) { /* // I don't know how to work with unaliasing. Thus I try to pretend // having an item. reset ($aliases); while (list ($alias, $translate) = each ($aliases)) { // I create the "columns" $cols[$alias][0] = array ( "value" => $translate, "flag" => FLAG_HTML); // and "aliases" $als [$alias] = array ("fce"=>"f_h", "param"=>$alias); } $item = new Item ("", $cols, $als, "", "" ,""); */ while (list ($key, $value) = each ($record)) # $record[$key] = $item->unalias ($value); $level = 0; $maxlevel = 0; $record[$key] = new_unalias_recurent($value, "", $level, $maxlevel, null, null, $aliases); } |
From: Mitra <mi...@ea...> - 2003-02-16 01:12:46
|
That looks like something i did ... I made the changes to bring all the unaliasing into one place, so that {....} worked the same wherever. Looking over this code in detail, it seems that the old version and the broken version do the same thing , i.e. $item->unalias($value) calls new_unalias_recurent($value,"",0,0,$this) The only difference is that the aliases are now accepted directly by new_unalias_recurent rather than creating a dummy item. What broke? - Mitra At 9:06 PM +0100 15/2/03, Jakub Adamek wrote: >Hi, > >someone broke my code in mail.php3, function send_mail_from_table. My >own code was commented out and the function new_unalias_recurent was >there instead. But the parameters to this function were all bad and it >was not working in the cycle as it should and so on. > >Why? Who? Not that it was so much damage, I only deleted the changes and >returned to my code. But it is strange because the changes were really >so incorrect. > >Jakub > >This is the broken state: > > if (is_array ($aliases)) { >/* > // I don't know how to work with unaliasing. Thus I try to >pretend > // having an item. > reset ($aliases); > while (list ($alias, $translate) = each ($aliases)) { > // I create the "columns" > $cols[$alias][0] = array ( > "value" => $translate, > "flag" => FLAG_HTML); > // and "aliases" > $als [$alias] = array ("fce"=>"f_h", "param"=>$alias); > } > $item = new Item ("", $cols, $als, "", "" ,""); >*/ > while (list ($key, $value) = each ($record)) ># $record[$key] = $item->unalias ($value); > $level = 0; $maxlevel = 0; > $record[$key] = new_unalias_recurent($value, "", $level, >$maxlevel, null, null, $aliases); > } > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Apc-aa-coders mailing list >Apc...@li... >https://lists.sourceforge.net/lists/listinfo/apc-aa-coders -- Mitra Technology Consulting - www.mitra.biz - mi...@mi... 02-6684-8096 or 0414-648-0722 Life is a Mystery to be Lived, not a Problem to be Solved |
From: Jakub A. <jak...@se...> - 2003-02-16 21:00:54
|
Mitra, if you look at the code, you have commented out a necessary part making the aliases array from a simple alias=>value array. And as you added two rows to the while() cycle, you forgot to add { }, so that the unaliasing was done only for the first key. Jakub > -----Original Message----- > From: apc...@li... > [mailto:apc...@li...] On Behalf Of Mitra > Sent: Sunday, February 16, 2003 2:05 AM > To: Jakub Adamek; apc...@so... > Subject: Re: [Apc-aa-coders] Who broke my code? > > > That looks like something i did ... > > I made the changes to bring all the unaliasing into one place, so > that {....} worked the same wherever. > > Looking over this code in detail, it seems that the old version and > the broken version do the same thing , i.e. $item->unalias($value) > calls new_unalias_recurent($value,"",0,0,$this) > > The only difference is that the aliases are now accepted directly by > new_unalias_recurent rather than creating a dummy item. > > What broke? > > - Mitra > > > > > > At 9:06 PM +0100 15/2/03, Jakub Adamek wrote: > >Hi, > > > >someone broke my code in mail.php3, function > send_mail_from_table. My > >own code was commented out and the function new_unalias_recurent was > >there instead. But the parameters to this function were all > bad and it > >was not working in the cycle as it should and so on. > > > >Why? Who? Not that it was so much damage, I only deleted the changes > >and returned to my code. But it is strange because the changes were > >really so incorrect. > > > >Jakub > > > >This is the broken state: > > > > if (is_array ($aliases)) { > >/* > > // I don't know how to work with unaliasing. Thus I try to > >pretend > > // having an item. > > reset ($aliases); > > while (list ($alias, $translate) = each ($aliases)) { > > // I create the "columns" > > $cols[$alias][0] = array ( > > "value" => $translate, > > "flag" => FLAG_HTML); > > // and "aliases" > > $als [$alias] = array ("fce"=>"f_h", "param"=>$alias); > > } > > $item = new Item ("", $cols, $als, "", "" ,""); > >*/ > > while (list ($key, $value) = each ($record)) > ># $record[$key] = $item->unalias ($value); > > $level = 0; $maxlevel = 0; > > $record[$key] = new_unalias_recurent($value, "", $level, > >$maxlevel, null, null, $aliases); > > } > > > > > > > >------------------------------------------------------- > >This sf.net email is sponsored by:ThinkGeek > >Welcome to geek heaven. > >http://thinkgeek.com/sf > _______________________________________________ > >Apc-aa-coders mailing list > >Apc...@li... > >https://lists.sourceforge.net/lists/listinfo/apc-aa-coders > > > -- > Mitra Technology Consulting - www.mitra.biz - mi...@mi... > 02-6684-8096 or 0414-648-0722 > > Life is a Mystery to be Lived, not a Problem to be Solved > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Apc-aa-coders mailing list > Apc...@li... > https://lists.sourceforge.net/lists/listinfo/apc-aa-coders > |