#31405 [Opn->Fbk]: auto_append_file unable to see global variables
ID: 31405
Updated by: sniper@php.net
Reported By: php20050104 at webfreezer dot com
-Status: Open
+Status: Feedback
Bug Type: PHP options/info functions
Operating System: SuSE Linux 8.1
PHP Version: 4.3.8
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-01-04 12:22:49] php20050104 at webfreezer dot com
Description:
------------
Setting the following option in a .htaccess file appends the given file
to any php file except it is terminated by exit:
php_value auto_append_file append.php
However although the manual states that this is just like a simple
include() this is not true.
An included file can see the global variables from the script it is
included from. Using the auto_append_file option does not allow the
appended script to see the global variables.
Using a normal include() works of course so there is not a problem with
the visibility of variables in included files in general.
Reproduce code:
---------------
apage.php:
<?php
$a="This should work!";
$GLOBALS["b"]="This should also work!";
echo "Script apage.php will finish now.<br>";
?>
append.php:
<?php
echo "And I say: ".$a."<br>";
echo "And also: ".$GLOBALS["b"]."<br>";
?>
Expected result:
----------------
Script apage.php will finish now.<br>
And I say: This should work!<br>
And also: This should also work!<br>
Actual result:
--------------
Script apage.php will finish now.<br>
And I say: <br>
And also: <br>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31405&edit=1
Thread (3 messages)