ID: 33430
Comment by: csaba at alum dot mit dot edu
Reported By: gk at proliberty dot com
Status: Open
Bug Type: Documentation problem
Operating System: RH 9 Linux
PHP Version: 5.0.3
New Comment:
I'd like to add that this bug exists on my 2005 Aug 31 PHP 5.1 / Win XP
Pro.
It seems that it is a bug and not a documentation problem, because each
of php.exe, php-win.exe, and php-cgi.exe include the auto_prepend_file
if invoked in interactive mode. Please change the Category
appropriately.
Here's how I tested (must be on a windows system):
Make one file, pop.php:
<?php
function popup($text, $title="PHP popup") {
$oWSH = new COM("WScript.Shell");
if (is_null($text)) $text = "NULL";
$oWSH->Popup($text, 4, $title, 131120);
}
popup ("inside pop.php");
?>
now it may be tested as follows from the command line (type in one
single long line at the prompt from the directory of php.php):
echo "<?php popup('prepend OK');var_dump(get_included_files());exit();
?>" | php.exe -d auto_prepend_file=pop.php -a
Of course you can replace php.exe with php-win.exe or php-cgi.exe In
all three cases you get the expected behaviour of two popups showing.
It would be very useful to have this bug fixed for my situation where I
want to have an automatic include file for the CLI versions of PHP, but
I want to disable that include file when I fall into PHP via Apache.
Which disabling I would do my means of the apache directive:
PHP_value auto_prepend_file none
Csaba Gabor from Vienna
PS. I have verified that the -r version does not work by typing, from
the command line:
php.exe -r pop.php
php-win.exe -r pop.php
(php-cgi.exe doesn't take a -r argument)
Previous Comments:
------------------------------------------------------------------------
[2005-06-22 09:38:44] gk at proliberty dot com
Description:
------------
auto_prepend_file, auto_append_file values are not effective in command
line (CLI-SAPI) code: php -r <code>
The value of auto_prepend_file is correctly reported as having been
read from the php.ini file (or equivalent -d command line assignment),
but the file is not 'prepended' prior to execution of command line
code.
If this is by design, then this behavior is inconsistent with how other
php.ini values are respected in the command line code environment and
should be documented since it is not intuitive.
Please do not bogusify this report.
If not a design bug, then this is a documentation bug and a feature
request.
Reproduce code:
---------------
cat /auto_prepend_file.php
<?php echo __FILE__."\n"; ?>
php -d auto_prepend_file=/auto_prepend_file.php -r 'echo "code";';
Expected result:
----------------
auto_prepend_file.php
code
Actual result:
--------------
code
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33430&edit=1