Skip to content

util.h: Introduce and use VIRT_ADD_ASSOC_ZVAL_EX()

The semantics of add_assoc_zval_ex() changed since PHP-5.0 era: while previously the key_len (the third argument) had to account for the trailing '\0' character, with PHP-7.0 it must be equal to the key length exactly. And we were passing strlen(...) + 1.

Therefore, do what we usually do in this case: introduce a VIRT_* macro so that when another incompatible change is made in one of future PHP releases we know to look this behaviour up.

For now, both supported versions (PHP-7 and PHP-8) behave the same.

This patch was originally sent by: Eric Schultz erics@lime-technology.com

Resolves: #7 (closed) Signed-off-by: Michal Privoznik mprivozn@redhat.com

Merge request reports