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: 2015-04-16 01:08 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:
Status: Open Package: *Configuration Issues
PHP Version: master-Git-2015-04-13 (Git) OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jan dot starke at t-systems dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

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
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu May 23 21:01:26 2019 UTC