Skip to content

Prevent using system DLLs when running the tests #17805

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
wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Feb 14, 2025

The search order for DLLs on Windows is (simplified):

  • the application folder
  • the system folder
  • all folders in the PATH

(The full details are documented on Microsoft Learn[1].)

As is, we're adding deps\bin to the PATH when running the tests, but any DLLs in the system folder take precedence, so these would be used instead of our intended dependencies. To mitigate that, we copy over all DLLs from deps\bin to our application folder (i.e. where php.exe, php-cgi.exe and phpdbg.exe are placed).

Since we're doing this, there is no more need to attempt to remove the OpenSSL DLLs in the system folder (what seems to be a bad idea anyway).

[1] https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order


Again, not sure which branch to target; went with PHP-8.3 as a compromise.

See https://github.com/php/php-src/actions/runs/13263835929/job/37026288607 for the problem this is trying to solve (in a more general way than just to cater to OpenSLL; there might be others in the system folder, too).

The search order for DLLs on Windows is (simplified):

* the application folder
* the system folder
* all folders in the `PATH`

(The full details are documented on Microsoft Learn[1].)

As is, we're adding `deps\bin` to the `PATH` when running the tests,
but any DLLs in the system folder take precedence, so these would be
used instead of our intended dependencies.  To mitigate that, we copy
over all DLLs from `deps\bin` to our application folder (i.e. where
php.exe, php-cgi.exe and phpdbg.exe are placed).

Since we're doing this, there is no more need to attempt to remove the
OpenSSL DLLs in the system folder (what seems to be a bad idea anyway).

[1] <https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order>
@cmb69 cmb69 marked this pull request as ready for review February 14, 2025 14:48
@cmb69 cmb69 requested a review from TimWolla as a code owner February 14, 2025 14:48
@cmb69 cmb69 closed this in c7bc14d Feb 16, 2025
@cmb69 cmb69 deleted the cmb/copy-dlls branch February 16, 2025 22:09
charmitro pushed a commit to wasix-org/php that referenced this pull request Mar 13, 2025
The search order for DLLs on Windows is (simplified):

* the application folder
* the system folder
* all folders in the `PATH`

(The full details are documented on Microsoft Learn[1].)

As is, we're adding `deps\bin` to the `PATH` when running the tests,
but any DLLs in the system folder take precedence, so these would be
used instead of our intended dependencies.  To mitigate that, we copy
over all DLLs from `deps\bin` to our application folder (i.e. where
php.exe, php-cgi.exe and phpdbg.exe are placed).

Since we're doing this, there is no more need to attempt to remove the
OpenSSL DLLs in the system folder (what seems to be a bad idea anyway).

[1] <https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order>

Closes phpGH-17805.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants