php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #25437 virtual() behaviour for php-files
Submitted: 2003-09-08 16:20 UTC Modified: 2017-01-08 06:09 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jonas dot info at gmx dot net Assigned: krakjoe (profile)
Status: Closed Package: Apache related
PHP Version: 4.3.3 OS: Win32; all?
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jonas dot info at gmx dot net
New email:
PHP Version: OS:

 

 [2003-09-08 16:20 UTC] jonas dot info at gmx dot net
Description:
------------
i have tested the virtual("file2.php"); feature in php 4.3.3. now it behaves like an include in every way. 
but i think it would be better to parse the script as there were no calling script, so it were called through apache, so that the variable $test would not be changed in the called script and the $_SERVER["PHP_SELF"] has to be the called script, not the calling.
so it would be good to add a new parameter to virtual() to set some ini options for the called script (espacially the "open_basedir" and "safe_mode" options, or in the apache per directory settings of the called script) to allow customers to add there own php scripts in a kind of more controlled environement.

Reproduce code:
---------------
<!-- called.php -->
<?php
	echo("this is: " . $_SERVER["PHP_SELF"] . "<br>");
	
	$test = "variable has changed";
?>

<!-- per_include.php -->
include:<br>
<?php
	$test = "variable set";
	
	include("called.php");
	
	echo($test);
?>

<!-- per_virtual.php -->
virtual:<br>
<?php
	$test = "variable set";
	
	virtual("called.php");
	
	echo($test);
?>

Expected result:
----------------
include:
this is: /path/per_include.php
variable has changed

virtual:
this is: /path/called.php
variable set

Actual result:
--------------
include:
this is: /path/per_include.php
variable has changed

virtual:
this is: /path/per_virtual.php
variable has changed

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 18:51 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Apache related
 [2017-01-08 06:09 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2017-01-08 06:09 UTC] krakjoe@php.net
This has been open for a decade, hasn't generated any conversation and so there would appear to be no appetite for this change. The explanation is probably that virtual is an extremely surprising function that everyone avoids.

Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 01:01:27 2024 UTC