php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44673 With CGI argv/argc starts from arguments, not from script
Submitted: 2008-04-08 21:10 UTC Modified: 2008-04-09 09:17 UTC
From: jc at chenailler dot com Assigned: dmitry (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5.2.6RC4 OS: gentoo
Private report: No CVE-ID: None
 [2008-04-08 21:10 UTC] jc at chenailler dot com
Description:
------------
Hy,

With PHP-5.2.6RC4 i have this probleme when using in command line :

usage :
php -q test.php a b c d

with php <= 5.2.5 this probleme didn't exists.

configure for both versions :
'./configure' '--with-fastcgi=/usr/local' '--enable-simplexml' '--enable-fastcgi' '--enable-force-cgi-redirect' '--prefix=/usr/local/php5' '--disable-cli' '--with-filepro' '--with-mysql=/usr' '--with-xml' '--disable-exif' '--enable-ftp' '--enable-bcmath' '--enable-calendar' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir' '--with-gettext' '--with-zlib-dir' '--enable-trans-sid' '--with-kerberos' '--with-openssl' '--enable-sysvsem' '--enable-sysvshm' '--with-gettext' '--with-dom' '--with-mcrypt' '--with-iconv' '--enable-mbstring=all' '--enable-mbregex' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--with-config-file-scan-dir=/etc/php.d' '--disable-pdo' '--without-sqlite' '--enable-inline-optimization'


Reproduce code:
---------------
<?php
echo "PHP_VERSION=".PHP_VERSION."\n";
echo "argc=$argc\nargv=";
print_r($argv);
?>


Expected result:
----------------
PHP_VERSION=5.2.5
argc=5
argv=Array
(
    [0] => test.php
    [1] => a
    [2] => b
    [3] => c
    [4] => d
)


Actual result:
--------------
PHP_VERSION=5.2.6RC4
argc=4
argv=Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-09 07:43 UTC] jani@php.net
Note: This only happens with CGI binary. CLI is fine.
 [2008-04-09 07:52 UTC] jani@php.net
Seems to have been broken by this patch by Dmitry:

# cvs diff -r1.267.2.15.2.52 -r1.267.2.15.2.53 sapi/cgi/cgi_main.c

http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.52&r2=1.267.2.15.2.53

Dmitry, can you please fix it..? :)
 [2008-04-09 09:17 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC