|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-01-17 22:53 UTC] support-forums4 at farmdev dot com
Description:
------------
see test script, run it like ...
$ php -f test_end_arg.php -- -h -f
PHP should execute the script as the equivalent of `test_end_arg.php -h -f`. This works in the cli version of php but not the cgi version (from command line). Sorry I couldn't test on more versions.
Cli version I tested with (PASSED) was :
====================
PHP Version => 5.0.4
System => Linux dev 2.4.18-1-686 #1 Wed Apr 14 18:20:10 UTC 2004 i686
Build Date => May 12 2005 14:12:56
Configure Command => './configure' '--prefix=/vol2/php5' '--with-apxs=/vol2/php5/bin/apxs' '-with-config-file-scan-dir=/vol2/php5/lib/php' '--enable-shared' '--with-zlib=shared' '--with-curl=shared,/vol2/php5' '--with-mcrypt=shared,/vol2/php5' '--with-mhash=shared,/vol2/php5' '--with-openssl=shared' '--with-gettext=shared' '--with-gd=shared' '--enable-wddx=shared' '--with-jpg-dir=/usr' '--with-png-dir=/usr' '--enable-dba=shared' '--with-mysql=shared,/usr/local/mysql' '--with-pgsql=shared,/usr/local/pgsql' '--enable-soap=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--with-libxml-dir=/vol2/php5'
Server API => Command Line Interface
====================================
CGI version I tested with (FAILED) was :
====================================
PHP Version 5.0.5
System FreeBSD dev2.leapfrogonline.com 4.11-RELEASE FreeBSD 4.11-RELEASE #0: Fri Ja i386
Build Date Sep 22 2005 16:22:00
Configure Command './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-spl' '--with-regex=php' '--disable-cli' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-fastcgi' '--prefix=/usr/local' 'i386-portbld-freebsd4.11'
Server API CGI/FastCGI
====================================
Reproduce code:
---------------
test_end_arg.php:
<?php
print_r($_SERVER['argv']);
assert( !in_array('--',$_SERVER['argv']));
?>
Expected result:
----------------
// see description about how to run the script
Array
(
[0] => test_end_arg.php
[1] => -h
[2] => -f
)
Actual result:
--------------
PHP Warning: assert() [<a href='function.assert'>function.assert</a>]: Assertion failed in /home/kumar/tmp/test_end_arg.php on line 3
Array
(
[0] => test_end_arg.php
[1] => --
[2] => -h
[3] => -f
)
<br />
<b>Warning</b>: assert() [<a href='function.assert'>function.assert</a>]: Assertion failed in <b>/home/kumar/tmp/test_end_arg.php</b> on line <b>3</b><br />
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
I understand it's not ideal that our server uses the cgi version from the command line but it is confusing that php includes `--' in the arguments when it has already gone so far as to pass through the extra arguments. In other words, if cgi should *never* be used on the command line, why doesn't: $ php -f test_end_arg.php -- -f -p simply produce: Array ( [0] => test_end_arg.php ) ? I think we can agree that the cgi version should be able to work from the command line. On the other hand, I'm sure there are a million more important bugs to fix ... but this did trip me up for a while and seems trivial to fix. thanks, Kumar