Skip to content

dl() breaks expectations regarding permanent or interned strings #9196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arnaud-lb opened this issue Jul 29, 2022 · 1 comment
Open

dl() breaks expectations regarding permanent or interned strings #9196

arnaud-lb opened this issue Jul 29, 2022 · 1 comment

Comments

@arnaud-lb
Copy link
Member

arnaud-lb commented Jul 29, 2022

Description

Creating this ticket to keep track of some issues related to dl() and permanent / interned strings:

Extensions loaded during a dl() call will try to allocate persistent interned strings for class names, function names, ini entries, etc. Normally, this is not allowed during a request.

The default in-request implementation of zend_string_init_interned still allows it, but the opcache implementation will simply return a non-interned string.

Calling dl() breaks in RC_DEBUG builds: #8606

This also breaks internal enums. The test in this branch will crash in debug builds: https://github.com/php/php-src/compare/master...arnaud-lb:php-src:internal-enums-dl-crash?expand=1

PHP Version

PHP 8.0

Operating System

No response

@mvorisek
Copy link
Contributor

mvorisek commented Oct 7, 2022

revert bfb4ee7 once fixed

@cmb69 cmb69 mentioned this issue Sep 22, 2024
5 tasks
cmb69 added a commit to cmb69/php-src that referenced this issue Sep 29, 2024
Prior to running the tests, the test runner checks for all generally
available extensions; it does this by scanning the `extension_dir` for
files matching the typical extension pattern, but verifies that the
file is actually a PHP extension by calling `dl()`.  However, `dl()`
has known issues[1].  On Windows CI we always get an ugly "zend_mm_heap
corrupted" message, and we even can't `dl()` ext/mysql when OPcache is
enabled[2].  So we better avoid the double-check with `dl()`, which is
unlikely to be necessary anyway.

[1] <php#9196>
[2] <php#8508>
cmb69 added a commit that referenced this issue Oct 3, 2024
Prior to running the tests, the test runner checks for all generally
available extensions; it does this by scanning the `extension_dir` for
files matching the typical extension pattern, but verifies that the
file is actually a PHP extension by calling `dl()`.  However, `dl()`
has known issues[1].  On Windows CI we always get an ugly "zend_mm_heap
corrupted" message, and we even can't `dl()` ext/mysql when OPcache is
enabled[2].  So we better avoid the double-check with `dl()`, which is
unlikely to be necessary anyway.

[1] <#9196>
[2] <#8508>
cmb69 added a commit to cmb69/php-src that referenced this issue Nov 1, 2024
`dl()` has known issues regarding permanent strings[1], so we better
avoid it, even if that means that we need to spawn two sub-processes.

[1] <php#9196>
cmb69 added a commit that referenced this issue Nov 1, 2024
Avoid dl() in bug77578.phpt

`dl()` has known issues regarding permanent strings[1], so we better
avoid it, even if that means that we need to spawn two sub-processes.

[1] <#9196>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants