From:             xuefer at 21cn dot com
Operating system: xp/linux
PHP version:      4.3.8
PHP Bug Type:     CGI related
Bug description:  #!php with paramters is broken

Description:
------------
touch php.ini

./test | grep php.ini

-i paramter works
but -c not

seems those spaces is not convert to '\0'

sapi/cli/php_cli.c

    while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind,
0))!=-1) {
        switch (c) {
        case 'c':
            cli_sapi_module.php_ini_path_override = strdup(php_optarg);
/*debug*/
printf("%d %d '%s'\n", (int) php_optarg[0], strlen(php_opt_arg),
php_optarg);
            break;
        case 'n':
            cli_sapi_module.php_ini_ignore = 1;
            break;
        }
    }


got "32 2 ' .'"


seems a problem of the shell

if -c is ok to be left broken.
-i shouldn't be working too

but allowing options in #! is very useful


Reproduce code:
---------------
#!/usr/bin/php -i -c .
// empty file


Expected result:
----------------
Configuration File (php.ini) Path => /etc/php.ini


Actual result:
--------------
Configuration File (php.ini) Path => ./php.ini


-- 
Edit bug report at http://bugs.php.net/?id=29658&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29658&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29658&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29658&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29658&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29658&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29658&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29658&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29658&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29658&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29658&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29658&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29658&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29658&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29658&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29658&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29658&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29658&r=float

Reply via email to