Two-phase boundary layer formation in a semi-infinite porous slab