Fixes for BIG-12858

Applied fixes to PHP Library as described here:

https://jira.bigcommerce.com/browse/BIG-12858