PHP: Fix possible issues with legacy 5.2 support logic.