The PHP7 variant of the macro wasn't safe if the hash key was not
a
string type. This was found when running php script with just
libvirt_connect call under xdebug session which segfaulted. This patch
makes the following changes:
* make sure that tmp_name is initialized to NULL
* set the key name only when zend_hash_get_current_key_ex did set it to
something which happens only when type is HASH_KEY_IS_STRING
* stash the key index in out php_libvirt_hash_key_info struct because it
wasn't there before and separate variable had to be used.
---
v1:
https://www.redhat.com/archives/libvir-list/2017-December/msg00151.html
Changes since v1:
* use zend_ulong in php_libvirt_hash_key_info struct so that no type
cast is needed
src/libvirt-connection.c | 8 +++-----
src/libvirt-php.c | 6 ++----
src/libvirt-php.h | 1 +
src/util.h | 16 +++++++++-------
4 files changed, 15 insertions(+), 16 deletions(-)