diff options
author | Olly Betts <olly@survex.com> | 2022-09-29 13:13:52 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2022-09-29 13:13:52 +1300 |
commit | 9908f9f310aeadb129b41d14d40de9f2163ffa24 (patch) | |
tree | dc750440a6c27ac8e3f5fa8f9d887c1d7ca4418c /Lib/php | |
parent | cb9c96011a42fb763e447da5869655f50d19f914 (diff) | |
download | swig-9908f9f310aeadb129b41d14d40de9f2163ffa24.tar.gz |
[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.
Diffstat (limited to 'Lib/php')
-rw-r--r-- | Lib/php/phpinit.swg | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/php/phpinit.swg b/Lib/php/phpinit.swg index 40f7b0766..ae72a10ae 100644 --- a/Lib/php/phpinit.swg +++ b/Lib/php/phpinit.swg @@ -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 %} |