Fix invalid memory reads when GC is on
Fix #802
Fix #910, 914
Merge pull request #916 from sjinks/issue-802

Deduplicate macros, Fix memleak in PHP < 5.4
Merge pull request #927 from sjinks/garbage-collection

[BUG] Fix invalid memory reads when GC is on