Elastic buckling of a porous beam