php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79884 PHP_CONFIG_FILE_PATH is meaningless
Submitted: 2020-07-22 08:24 UTC Modified: 2020-07-22 08:55 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: PHP options/info functions
PHP Version: 7.3Git-2020-07-22 (Git) OS: Windows
Private report: No CVE-ID: None
 [2020-07-22 08:24 UTC] cmb@php.net
Description:
------------
On Windows, PHP_CONFIG_FILE_PATH is determined during *build* time
(using the environment variable SystemRoot, and falling back to an
empty string if that is not set).

However, when constructing the php_ini_search_path during *run*
time, this constant is ignored, and instead the results of
GetWindowsDirectory() and GetSystemWindowsDirectory() are added to
the INI search path[1].

While in the most typical case either is C:\Windows, both may
actually differ; thus, PHP_CONFIG_FILE_PATH must not be set to any
hard-coded value during *build* time.

[1] <https://github.com/php/php-src/blob/php-7.3.20/main/php_ini.c#L542-L563>


Test script:
---------------
<?php
var_dump(getenv("SystemRoot"), PHP_CONFIG_FILE_PATH);
?>


Expected result:
----------------
string(10) "D:\WINDOWS"
string(10) "D:\WINDOWS"



Actual result:
--------------
string(10) "D:\WINDOWS"
string(10) "C:\WINDOWS"


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-22 08:55 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #79884: PHP_CONFIG_FILE_PATH is meaningless
On GitHub:  https://github.com/php/php-src/pull/5884
Patch:      https://github.com/php/php-src/pull/5884.patch
 [2020-07-22 08:55 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-07-23 13:44 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=15efb96d4ce8003cca1c5fdcda4488c1827065d4
Log: Fix #79884: PHP_CONFIG_FILE_PATH is meaningless
 [2020-07-23 13:44 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC