|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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.
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
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.