Edit report at https://bugs.php.net/bug.php?id=61378&edit=1

 ID:                 61378
 Comment by:         rk at srsbiz dot pl
 Reported by:        vr...@php.net
 Summary:            php -H doesn't work
 Status:             Open
 Type:               Bug
 Package:            CGI/CLI related
 Operating System:   Irrelevant
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

This switch works, but does not hide arguments from running script (that would 
be rather pointless to pass arguments and switch to make them inaccessible) but 
from other users using same server (using 'ps aux' for example).  

Try for yourself:

test.php:
<?php
var_dump($argv);
sleep(120);
?>

php test.php --mypass=adminadmin

on second terminal:

ps aux | grep adminadmin

expected output: 

root      9627  0.0  0.0   3256   740 pts/2    S+   21:09   0:00  php test.php 
--mypass=adminadmin

now try running with -H:

php -H test.php --mypass=adminadmin

and on second trerminal you should have no match, while greping only for php, 
you may find it, without any arguments:

ps aux | grep php

root     10012  0.8  0.8  44524  9156 pts/1    S+   21:10   0:00 php


Previous Comments:
------------------------------------------------------------------------
[2012-03-13 19:45:21] vr...@php.net

The following patch has been added/updated:

Patch Name: hide-args.patch
Revision:   1331667921
URL:        
https://bugs.php.net/patch-display.php?bug=61378&patch=hide-args.patch&revision=1331667921

------------------------------------------------------------------------
[2012-03-13 19:44:54] vr...@php.net

Description:
------------
`php -H` or `php --hide-args` should hide passed arguments from the running 
script but it does nothing. I've tried it on Windows and Linux.

I think that this feature can be safely removed because it doesn't work for 
ages (at least since PHP 5.2.10 but probably longer) and I see only a little 
value in it. It is also the only undocumented option at 
http://php.net/features.commandline.options


Test script:
---------------
php -H argv.php a b

argv.php:
<?php
print_r($argv);
?>


Expected result:
----------------
Array
(
)


Actual result:
--------------
Array
(
    [0] => argv.php
    [1] => a
    [2] => b
)



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61378&edit=1

Reply via email to