I believe your problem is because your version of PHP doesn't include JSON support. This is most likely due to having a version prior to 5.2.0. You should upgrade to a later version if this is true for security reasons, but if you don't or cant upgrade, you can try this solution:
You are correct in that we are not running PHP 5.2, and your solution worked like a charm. The only issue we had was that in the code you provided the function_exists() calls had the arguments inside "ticks" (`) instead of single quotes ('), but that was easily corrected.