Hey!, this is a good question. The 'valid' option is the only one that is having problems in Octave. For example, in other places of cnnbp.m, convn() is used but not the 'valid' version. Additionally, in other places where the 'valid' version is used the second argument is somethig of dimensionality MxNx1. This is the reason why it is working in these cases. Because of the third dimension being '1'. The Octave implementation is having problems fliping the input, but this error is not present when the dimension is 1, as fliping would give the same result.
That's why you only need to replace it there. Hope I didnt mess things, do not hesitate to ask clarification.