[php] Initialise zval in directorin typemaps

SWIG_SetPointerZval() requires the zval structure passed to be
initialised (so it can handle the constructor case where the zval is
already initialised as a PHP object.

I couldn't think of a suitable regression test for this, but it fixes 2
issues detected by running director_basic under valgrind.
This commit is contained in:
Olly Betts 2022-01-24 13:32:22 +13:00
commit 5f5a8f2d4a

View file

@ -419,6 +419,7 @@
SWIGTYPE &,
SWIGTYPE &&
%{
ZVAL_UNDEF($input);
SWIG_SetPointerZval($input, (void *)&$1, $1_descriptor, $owner);
%}
@ -460,6 +461,7 @@
%typemap(directorin) SWIGTYPE
%{
ZVAL_UNDEF($input);
SWIG_SetPointerZval($input, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, 1);
%}