Yep, that is a pretty funny blooper. I can sympathize with that trooper because as a tall person it sucks to hit your head on things. The stormtroopers in the OT are all over the place. They storm the Tantive IV like a boss, then one smacks his head on a door, they overrun the rebels on Hoth, then get demolished at Endor by carebears. Stack exchange has a few threads about the stormtrooper elite/inept discrepancy. I guess it is just a tired movie making principle, make bad guys crappy to accentuate how OmiGoshAwesome! the good guys are.
The whole smack his head on the door thing was probably an oversight, because the guys under those helmets really couldn't see well. The Storm Troopers being so "incompetent" at the Death Star in general is just Vaders old tracking device trick (Really, that already worked in Rebels, do these guys never learn? Doesn't Leia talk to her father?). Endor is weird, but at least there is a sweet space battle to distract us from the nonsense.
