PHP <5.3.4 compat (is_a() usage)

Our build infrastructure still runs an ancient 5.3.3,
and given this is the only blocker for it, worth
complicating the code a bit to retain this compatibility.