php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69436 .user.ini in DOCUMENT_ROOT will not be found
Submitted: 2015-04-13 13:19 UTC Modified: 2021-08-03 11:51 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jan dot starke at t-systems dot com Assigned: cmb (profile)
Status: Duplicate Package: *Configuration Issues
PHP Version: master-Git-2015-04-13 (Git) OS: Windows
Private report: No CVE-ID: None
 [2015-04-13 13:19 UTC] jan dot starke at t-systems dot com
Description:
------------
considering the current implementation of php_cgi_ini_activate_user_config in cgi_main.c, .user.ini will never be read if the current working equals DOCUMENT_ROOT:

<code>
ptr = s2 + start;  /* start is the point where doc_root ends! */

/* the following condition will never be true, because ptr points to the last character of the directory name (see above), which is, by implementation, no DEFAULT_SLASH. */
while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) { /*...*/ }

</code>

Expected result:
----------------
.user.ini will be read, if it is stored in DOCUMENT_ROOT, or in the runtime folder of the application server (i.e. php-cgi), no matter if both folders are identical.

Actual result:
--------------
If .user.ini is stored in DOCUMENT_ROOT, and your application server has DOCUMENT_ROOT as runtime folder, then .user.ini will not be read.

If you change DOCUMENT_ROOT to something invalid, and make the application server run in the folder where .user.ini is stored, then .user.ini will be read.

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-14 09:38 UTC] jan dot starke at t-systems dot com
it seems that this behaviour occurs because the trailing slash ist removed in sapi_cgi_activate, just before php_cgi_ini_activate_user_config is called:

php_cgi_ini_activate_user_config assumes that the string which ptr points to (part of s2) contains at least one slash after ptr:

/dir1/dir2/dir3/
               ^
   ptr --------+

but if the slash is removed, then the while loop is not entered

I don't know why the slash is removed, and I have no problem with that. I'd suggest that php_cgi_ini_activate_user_config should not make any assumption about trailing slashes in folder names.
 [2015-04-16 01:08 UTC] cmb@php.net
-Package: Directory function related +Package: *Configuration Issues
 [2021-08-03 11:51 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Operating System: any +Operating System: Windows -Assigned To: +Assigned To: cmb
 [2021-08-03 11:51 UTC] cmb@php.net
Yeah, you're right, although this is a Windows only issue, and has
been reported as bug #79489, which is fixed as of PHP 7.3.19 and
7.4.7, respectively.  Closing as duplicate.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC