Fix a segfault with zval_ptr_dtor

Tested with PHP 5.4.16

Bug: 51551
Change-Id: I49827fc0e671e86d8fd66677bf7f1b5fbf9baad1
Merge "Fix a segfault with zval_ptr_dtor"