php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71234 INI files are loaded even invoked as -n --version
Submitted: 2015-12-29 10:11 UTC Modified: 2015-12-30 02:52 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: miloslav dot hula at gmail dot com Assigned: bwoebi (profile)
Status: Closed Package: phpdbg
PHP Version: 7.0.1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: miloslav dot hula at gmail dot com
New email:
PHP Version: OS:

 

 [2015-12-29 10:11 UTC] miloslav dot hula at gmail dot com
Description:
------------
phpdbg tries to load `php.ini` files when invoked as `-n --version`.


Actual result:
--------------
open("./php-phpdbg.ini", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("/home/milo/bin/php-bin/7.0.0/lib/php-phpdbg.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./php.ini", O_RDONLY)             = 4

# When you have php.ini in CWD, it can lead to unexpected errors like

$ /home/milo/php/phpdbg-7.0.1 -n --version
Xdebug requires Zend Engine API version 220131226.
The Zend Engine API version 320151012 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.

phpdbg 0.5.0 (built: Dec 29 2015 08:49:43)
PHP 7.0.1, Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies


Patches

bug71234.patch (last revision 2015-12-30 02:52 UTC by laruence@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-29 10:26 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2015-12-29 10:26 UTC] laruence@php.net
this seems by design, and it only affects -h and --version

and we have the same behavior in cli sapi:

$ sapi/cli/php -n --version
PHP 7.0.3-dev (cli) (built: Dec 23 2015 12:12:24) ( NTS DEBUG )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
 [2015-12-29 10:45 UTC] miloslav dot hula at gmail dot com
I don't understand the example you posted.

When I'm trying:
strace /home/milo/php/php-7.0.1 -n --version 2>&1 | less
strace /home/milo/php/php-cgi-7.0.1 -n --version 2>&1 | less

There are no INI loadings in system calls trace.

Btw. order of -n and --version matters.
 [2015-12-30 01:11 UTC] bwoebi@php.net
-Status: Not a bug +Status: Re-Opened
 [2015-12-30 01:11 UTC] bwoebi@php.net
I'm not sure, but looks like a bug to me in CLI SAPI then too, when order is mattering?
 [2015-12-30 02:38 UTC] laruence@php.net
I see, I made a mistake, you are right, sapi/cli is not affected.
 [2015-12-30 02:52 UTC] laruence@php.net
The following patch has been added/updated:

Patch Name: bug71234.patch
Revision:   1451443920
URL:        https://bugs.php.net/patch-display.php?bug=71234&patch=bug71234.patch&revision=1451443920
 [2015-12-30 02:52 UTC] laruence@php.net
-Assigned To: +Assigned To: bwoebi
 [2015-12-30 02:52 UTC] laruence@php.net
@bob, I attached a patch, as you are the maintainer of phpdbg, could you please have a look? thanks
 [2015-12-30 02:52 UTC] laruence@php.net
-Status: Re-Opened +Status: Assigned
 [2016-10-16 13:41 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d82da7de3a460f1eee3d34448be79bca3de7abc1
Log: Fixed bug #71234 (INI files are loaded even invoked as phpdbg -n --version)
 [2016-10-16 13:41 UTC] bwoebi@php.net
-Status: Assigned +Status: Closed
 [2016-10-16 13:48 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d82da7de3a460f1eee3d34448be79bca3de7abc1
Log: Fixed bug #71234 (INI files are loaded even invoked as phpdbg -n --version)
 [2016-10-16 13:48 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d82da7de3a460f1eee3d34448be79bca3de7abc1
Log: Fixed bug #71234 (INI files are loaded even invoked as phpdbg -n --version)
 [2016-10-17 10:06 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d82da7de3a460f1eee3d34448be79bca3de7abc1
Log: Fixed bug #71234 (INI files are loaded even invoked as phpdbg -n --version)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC