Skip to content

Commit 6ed242d

Browse files
johnstevensonnikic
authored andcommitted
Fixed #73124: php_ini_scanned_files()
Additional ini files are reported using the --ini option, but not by `php_ini_scanned_files()`, which relied on PHP_CONFIG_FILE_SCAN_DIR.
1 parent 8b57a5b commit 6ed242d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ PHP NEWS
3333
segment fault). (Nikita)
3434
. Fixed bug #75409 (accept EFAULT in addition to ENOSYS as indicator
3535
that getrandom() is missing). (sarciszewski)
36+
. Fixed bug #73124 (php_ini_scanned_files() not reporting correctly).
37+
(John Stevenson)
3638

3739
- Zip:
3840
. Fixed bug #75540 (Segfault with libzip 1.3.1). (Remi)

ext/standard/info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ PHP_FUNCTION(php_ini_scanned_files)
13951395
return;
13961396
}
13971397

1398-
if (strlen(PHP_CONFIG_FILE_SCAN_DIR) && php_ini_scanned_files) {
1398+
if (php_ini_scanned_files) {
13991399
RETURN_STRING(php_ini_scanned_files);
14001400
} else {
14011401
RETURN_FALSE;

ext/standard/tests/bug73124.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #73124 (php_ini_scanned_files relied on PHP_CONFIG_FILE_SCAN_DIR)
3+
--SKIPIF--
4+
<?php
5+
if (!empty(PHP_CONFIG_FILE_SCAN_DIR)) die("Skip: PHP_CONFIG_FILE_SCAN_DIR must not be available");
6+
?>
7+
--FILE--
8+
<?php
9+
$tempDir = sys_get_temp_dir();
10+
putenv('PHP_INI_SCAN_DIR='.$tempDir);
11+
12+
$inifile = $tempDir.DIRECTORY_SEPARATOR.'scan-dir.ini';
13+
@unlink($inifile);
14+
file_put_contents($inifile, "\n");
15+
16+
$php = getenv('TEST_PHP_EXECUTABLE');
17+
passthru('"'.$php.'" -r "print_r(php_ini_scanned_files());"');
18+
19+
putenv('PHP_INI_SCAN_DIR=');
20+
@unlink($inifile);
21+
?>
22+
--EXPECTREGEX--
23+
.*[\/\\]scan-dir\.ini.*|.*[\/\\]scan-dir\.ini
24+
Done

0 commit comments

Comments
 (0)