From: e-phpbug at erowid dot org Operating system: freebsd PHP version: 4.3.4 PHP Bug Type: Apache related Bug description: virtual() function does not behave as documented
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 bug report at http://bugs.php.net/?id=27111&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27111&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27111&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27111&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27111&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27111&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27111&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27111&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27111&r=support Expected behavior: http://bugs.php.net/fix.php?id=27111&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27111&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27111&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27111&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27111&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27111&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27111&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27111&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27111&r=float
