Repository navigation
Fix unregistering ini entries of dynamically loaded extension - #8435
Conversation
4e62576 to
31c303f
Compare
|
This is supposed to fix #8185, I think. |
e9c08ee to
45c10f5
Compare
cmb69
left a comment
There was a problem hiding this comment.
Thank you for the PR! Before more detailed review, we need to clarify whether this constitutes an ABI break (if so, we cannot target any of the stable PHP versions).
cmb69
left a comment
There was a problem hiding this comment.
Overall, this looks good to me, but I left some style nits.
There was a problem hiding this comment.
Do we really need this file? Isn't that already handled by .gitignore in the root?
There was a problem hiding this comment.
I think you should add yourself as author.
There was a problem hiding this comment.
I don't see the point in having an own version for a bundled extension; consider to use PHP_VERSION instead of some hard-coded value.
There was a problem hiding this comment.
I prefer
| if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { | |
| if (PHP_OS_FAMILY === 'Windows') { |
There was a problem hiding this comment.
Do we have to cater to macOS which uses .dylib as far as I know?
There was a problem hiding this comment.
I checked because I was not sure. The PHP build appears to generate .so files. The CI looks ok too (no mention of skipping or failing these tests).
There was a problem hiding this comment.
I very much prefer to explicitly have the closing PHP tags in .phpt files, so that syntax highlighting works.
There was a problem hiding this comment.
Aren't they also required for another reason? But yes I agree adding the closing tags is better
There was a problem hiding this comment.
No. The sections containing PHP code are extracted to temporary files, so closing tags are not strictly needed.
There was a problem hiding this comment.
For me personally it's because I like to be able to run tests quickly without invoking run-tests, by just doing php thetest.phpt
Girgias
left a comment
There was a problem hiding this comment.
Other than the PHPT test changes LGTM
There was a problem hiding this comment.
| <?php include __DIR__ . "/../../../dl_test/tests/skip.inc"; | |
| <?php include dirname(__DIR__, 3) . "/dl_test/tests/skip.inc"; |
Might be 2, not sure of the top of my head.
There was a problem hiding this comment.
Aren't they also required for another reason? But yes I agree adding the closing tags is better
| * lead to death. | ||
| */ | ||
| if (directives != EG(ini_directives)) { | ||
| ZEND_ASSERT(module_type == MODULE_TEMPORARY); |
There was a problem hiding this comment.
@arnaud-lb just stumbled on this when fixing FPM extension loading using php_admin_value[extension] . It actaully uses php_dl and initializes permanent module so this is actually not going to work so I had to remove this assertion in #12277 . FPM is single threaded so it should not impact this issue - it just really needs to remove the assertion.
There might be potentially other issues with using dl for permanent modules and it has got some limitation but think the whole concept of using php_dl in FPM is really problematic which will require some bigger changes in FPM to get it rif of it (introduction of pool manager).
Anyway if you see some bigger problem with my change, please comment on that PR.
This fixes a crash involving ZTS and dl().
In ZTS, the global
registered_zend_ini_directivesis copied to a thread-specificEG(ini_entries). Extensions loaded withdl()register their ini entries inEG(ini_entries), however they unregister them fromregistered_zend_ini_directives, which has no effect and leaves the entries inEG(ini_entries). This leads to problems when destroyingEG(ini_entries)later, because it references resources that are already freed.This change ensures that MODULE_TEMPORARY modules will unregister their entries from
EG(ini_entries).I added a test extension specifically for the purpose of testing dl(). I could have used the
zend_testfor that, but I felt that with a dedicated extension it would be harder to accidentally nerf/no-op the tests.