ID: 35082 Updated by: [EMAIL PROTECTED] Reported By: Christoph dot Freundl at informatik dot uni-erlange -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Linux PHP Version: Irrelevant New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Environment variables set in the requested file are not visible to the calling script." + "equivalent" changed to "similar". Previous Comments: ------------------------------------------------------------------------ [2005-11-03 22:39:21] Christoph dot Freundl at cs dot fau dot de I can see that argument (which I already have been told when I brought up this topic on the php-general mailing list) but then I wondered why the corresponding SSI command <!--#include virtual=...--> keeps the variables so I peeked into both Apache and PHP source code and saw the similiarities (most notably the subrequests) between Apache's handle_include() and PHP's virtual() implementation. But as I have no idea of both projects' internals - and I still would favour virtual() to behave exactly like the SSI include ;-) - I decided to report the differing behaviour as a bug. So, if the different behaviour is estimated as being correct then I would still suggest to change the documentation of virtual() by deleting the statement that virtual is _equivalent_ to the SSI call. ------------------------------------------------------------------------ [2005-11-03 21:48:24] [EMAIL PROTECTED] Actually, the behavior is correct as virtual() does a new apache subrequest, which do not interact with each other. Not sure about the messages you get though. ------------------------------------------------------------------------ [2005-11-03 14:45:18] Christoph dot Freundl at cs dot fau dot de I tried with the php5-200511030930 snapshot. The behaviour is still the same, in fact I get some other errors which show up in the apache error log: When calling info.shtml: /home/chfreund/php5-200511030930/Zend/zend_hash.c(1375) : ht=0x4074f780 is already destroyed When calling info.php: /home/chfreund/php5-200511030930/main/streams/streams.c(227) : Freeing 0x08242D34 (128 bytes), script=/srv/www/htdocs/info.php /home/chfreund/php5-200511030930/main/main.c(855) : Actual location (location was relayed) /home/chfreund/php5-200511030930/main/streams/plain_wrapper.c(180) : Freeing 0x0819791C (116 bytes), script=/srv/www/htdocs/info.php /home/chfreund/php5-200511030930/main/main.c(855) : Actual location (location was relayed) /home/chfreund/php5-200511030930/main/fopen_wrappers.c(539) : Freeing 0x081E71D4 (28 bytes), script=/srv/www/htdocs/info.php Zend/zend_language_scanner.c(3138) : Freeing 0x0819785C (140 bytes), script=/srv/www/htdocs/info.php === Total 4 memory leaks detected === ------------------------------------------------------------------------ [2005-11-03 10:39:42] Christoph dot Freundl at informatik dot uni-erlange Description: ------------ If you use virtual() to include an shtml file which sets an environment variable via <!--#set...-->, the set variable is not visible after the virtual() call. Reproduce code: --------------- setvar.shtml ------------------------------------------------- <!--#set var="myvar" value="myval" --> ------------------------------------------------- showvar.php ------------------------------------------------- <?php echo apache_getenv( "myvar" ); ?> ------------------------------------------------- info.shtml ------------------------------------------------- <!--#include virtual="setvar.shtml" --> <!--#include virtual="showvar.php" --> ------------------------------------------------- info.php ------------------------------------------------- <?php virtual( "setvar.shtml" ); echo apache_getenv( "myvar" ); ?> ------------------------------------------------- Expected result: ---------------- I expect that info.shtml and info.php should both give the same result, i.e. show "myval". However, info.shtml does but info.php does not. If this is a wanted behaviour (which I hope it is not), then at least the documentation of virtual() --- "virtual() is an Apache-specific function which is equivalent to <!--#include virtual...--> in mod_include." --- is wrong. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35082&edit=1