ID: 27111 Updated by: [EMAIL PROTECTED] Reported By: e-phpbug at erowid dot org -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: freebsd PHP Version: 4.3.4 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. Copied from sources: "This function works only when PHP is compiled as an Apache module, since it uses the Apache API for doing sub requests." Previous Comments: ------------------------------------------------------------------------ [2004-01-31 21:06:18] e-phpbug at erowid dot org Description: ------------ Documentation for virtual() claims that it should work like an apache sub-request like the shtml #include virtual command. It does not. Bug 26500 is reporting the same bug but appears to have been closed by someone who does not understand the issue. It is clear that it is not doing this as advertised for php scripts. What should be creating an http request is instead clearly short-circuting to a PHP include() call with the docroot pre-pended when the target is a php script. This results in any CGI PHP called through virtual being called as a sub-component of the current PHP script instead of as its own execution, with its own environment, own POST/GET variables, etc. This clearly violates the documented purpose of the call (to replicate the apache shtml functionality). Also, as a side effect of how this behaves, virtual changes the cwd in the calling script (a behaviour that should not happen with an apache subrequest). Both of these problems are solved if http://www.host.com/ is pre-pended to the string and passed to include() instead, which actually generates an http sub-request. Proposed solutions: 1) change the documentation so that it doesn't claim this is the same as apache's include-virtual directive. 2) fix the problem since this is clearly the intended behaviour for the function. Reproduce code: --------------- The following should have equivalent effect, given the documentation: <!--#include virtual="/path/to/stuff.php?Var=Value"--> and <? virtual("/path/to/stuff.php?Var=Value"); ?> with stuff.php as: <? $Var = $_GET['Value']; print "Var: $Var <br>\n"; ?> Expected result: ---------------- The shtml results in: Var: Value <br> Actual result: -------------- the php results in: PHP warnings (if you E_ALL set) Var: <br> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27111&edit=1
