Skip to content

dl("mysqli") fails when OPcache is enabled #8508

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

Closed
cmb69 opened this issue May 6, 2022 · 1 comment
Closed

dl("mysqli") fails when OPcache is enabled #8508

cmb69 opened this issue May 6, 2022 · 1 comment

Comments

@cmb69
Copy link
Member

cmb69 commented May 6, 2022

Description

The following code:

<?php
dl("mysqli");

Resulted in this output:

Fatal error: Internal zvals cannot be refcounted in Unknown on line 0

But I expected this output instead:

The problem is mysqli_exception::$sqlstate; its value "00000" won't would be interned, and so the respective check

php-src/Zend/zend_API.c

Lines 3814 to 3816 in 95f5f9d

if (Z_REFCOUNTED_P(property)) {
zend_error_noreturn(E_CORE_ERROR, "Internal zvals cannot be refcounted");
}

fails, causing PHP to bail out.

This is particularly an issue regarding the tests, because as of PHP 8.1.0, run-tests.php tries to figure out which dynamic extension can be loaded to gather the $exts_to_tests; however, due to this issue the list is not complete, so when OPcache is enabled, about 2.000 tests are not executed on AppVeyor CI.

PHP Version

PHP-8.0

Operating System

Windows

@cmb69
Copy link
Member Author

cmb69 commented Jul 30, 2022

Closing in favor of #9196, which describes the root cause.

@cmb69 cmb69 closed this as completed Jul 30, 2022
cmb69 added a commit to cmb69/php-src that referenced this issue Sep 16, 2022
As described in php#8508, if OPcache is enabled, ext/mysqli can't be
dl()'d; we work around that by loading the extension on startup.
cmb69 added a commit that referenced this issue Sep 17, 2022
As described in #8508, if OPcache is enabled, ext/mysqli can't be
dl()'d; we work around that by loading the extension on startup.

Closes GH-9557.
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>
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

1 participant