php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73124 php_ini_scanned_files() not reporting correctly
Submitted: 2016-09-20 11:01 UTC Modified: 2017-11-16 18:39 UTC
From: john-stevenson at blueyonder dot co dot uk Assigned:
Status: Closed Package: *Configuration Issues
PHP Version: 5.6.26 OS: Windows 10
Private report: No CVE-ID: None
 [2016-09-20 11:01 UTC] john-stevenson at blueyonder dot co dot uk
Description:
------------
When PHP has not been compiled using the --with-config-file-scan-dir option, php_ini_scanned_files() does not report additional ini files that have been scanned via the PHP_INI_SCAN_DIR environment variable .

However the correct information is shown when running php --ini

I realize that this is an edge-case, but PHP_INI_SCAN_DIR is used regardless of the compile option in php_init_config():
https://github.com/php/php-src/blob/1c295d4a9ac78fcc2f77d6695987598bb7abcb83/main/php_ini.c#L609

Whereas in php_ini_scanned_files() this option is required for the data to reported (even though the data exists):
https://github.com/php/php-src/blob/fcc6f2df5986bb9615a658cc717b1a92922462d2/ext/standard/info.c#L1388 


Test script:
---------------
Using a Windows build (so no --with-config-file-scan-dir) create a file named "date.ini" somewhere containing the line:

date.timezone = Antarctica/McMurdo

Now run the following:
set PHP_INI_SCAN_DIR=path\to\somewhere

php -r "var_dump(php_ini_scanned_files());var_dump(ini_get('date.timezone'));" 

Expected result:
----------------
Command line code:1:
string(???) "path\to\somewhere\date.ini"
Command line code:1:
string(18) "Antarctica/McMurdo"

Actual result:
--------------
Command line code:1:
bool(false)
Command line code:1:
string(18) "Antarctica/McMurdo"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-16 18:39 UTC] john-stevenson at blueyonder dot co dot uk
Fixed: https://github.com/php/php-src/pull/2921
 [2017-11-28 22:35 UTC] nikic@php.net
Automatic comment on behalf of john-stevenson@blueyonder.co.uk
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6ed242dfc84a9e58f6e03184d99611f2cfb2a265
Log: Fixed #73124: php_ini_scanned_files()
 [2017-11-28 22:35 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2017-11-28 22:37 UTC] nikic@php.net
Automatic comment on behalf of john-stevenson@blueyonder.co.uk
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6ed242dfc84a9e58f6e03184d99611f2cfb2a265
Log: Fixed #73124: php_ini_scanned_files()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 04:01:27 2024 UTC