Fix uses of uninitialised zval

SWIG_SetPointerZval() now checks if the passed zval is an object,
so use ZVAL_UNDEF() before in cases where we create a zval to pass.
This commit is contained in:
Olly Betts 2021-05-05 11:55:07 +12:00
commit 542f6ca440

View file

@ -47,6 +47,7 @@
SWIGTYPE [] %{
{
zval z;
ZVAL_UNDEF(&z);
SWIG_SetPointerZval(&z, (void*)$value, $1_descriptor, 0);
zval_copy_ctor(&z);
zend_declare_class_constant(SWIGTYPE_$class_ce, "$const_name", sizeof("$const_name") - 1, &z);
@ -90,6 +91,7 @@
SWIGTYPE &&,
SWIGTYPE [] {
zend_constant c;
ZVAL_UNDEF(&c.value);
SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0);
zval_copy_ctor(&c.value);
c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0);