[php] Fix testcase segfaults with PHP 8.0
These testcases were segfaulting: prefix director_using_member_scopes virtual_poly The fix here is admittedly a hack - we perform the initialisation of EG(class_table) from CG(class_table) which PHP will do, but hasn't yet. PHP doesn't seem to clearly document which API calls are actually valid in minit or other initialisation contexts, but the code we're generating works with all PHP 7.x and PHP 8.x versions aside from PHP 8.0 so it seems this is a bug in PHP 8.0 rather than that we're doing something invalid, and we need to work with existing PHP 8.0 releases so this hack seems a necessary evil. It will at least have a limited life as PHP 8.0 is only in active support until 2022-11-26, with security support ending a year later. Fixes #2383.
This commit is contained in:
parent
cb9c96011a
commit
9908f9f310
1 changed files with 4 additions and 0 deletions
|
|
@ -9,4 +9,8 @@
|
|||
SWIG_php_minit {
|
||||
zend_class_entry SWIGUNUSED internal_ce;
|
||||
SWIG_InitializeModule((void*)&module_number);
|
||||
#if PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION == 0
|
||||
/* This hack is needed to avoid segfaults. */
|
||||
EG(class_table) = CG(class_table);
|
||||
#endif
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue