if glGetIntegerv(GL_STENCIL_BITS) is returning 0, then you messed up your context creation.
commonly your depth+stencil buffers are a single buffer 24.8.
of course, gl treats them separately which results in some fun...
some hardware actually supports 32bit depth buffers!...
but of course, depth+stencil buffer then means that this then means that you have 0bit stencil buffers.
so make sure you're actually requesting a stencil buffer at context creation.
that's my guess.