The game was marked by the taking of a quick free kick which allowed Porto to score their second goal.
Wenger feels that Hansson made at least five technical errors, but Gallagher feels that nothing Hansson did was outside the laws of the game.
"In theory everything he has done he will be able to justify in law," Gallagher told Sky Sports News.
"Why we look at it so strangely is because it is totally out of sync with what happens in the modern game.
"The Arsenal versus Chelsea match years ago was about the last time we had a quick free-kick [when Thierry Henry scored as Petr Cech lined up his wall].
"We just don't see it because the referee wants to control the situation. He demands now that players are back 10 yards and that the ball is played properly and you even see them walking now with the whistle in the air.
"It is almost the case that every free-kick I see in the Premier League and Champions League is marked out 10 yards, whistle in the air."
Nevertheless, Gallagher still expressed a certain amount of surprise that the goal had been allowed to stand.
"He [Hansson] can say he got everything right," the former official added.
"He will say he thought it was a deliberate backpass. He will say the goalkeeper is not entitled to hold on to the ball so he has given it.
"The problem was that he made a quick decision. He has gone to the area quickly to defuse any argument, which there wasn't going to be because Sol Campbell was so disappointed he held his head in his hands.
"In that situation I was really surprised because normally the goalkeeper drops the ball behind him or something and makes someone fetch it, which would delay matters. These are the things that normally come into play which didn't.
"I fully expected the goal to be disallowed, although in law it is correct. Once again we are left with this mystery of what was his [Hansson's] mindset."