Bug #18000 Updated: localized http header request includes variable scope

From: Date: Wed, 26 Jun 2002 20:06:31 +0000
Subject: Bug #18000 Updated: localized http header request includes variable scope
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12163@lists.php.net to get a copy of this message
ID: 18000 Updated by: rasmus@php.net Reported By: code@4arrow.com Status: Bogus Bug Type: Feature/Change Request Operating System: UNIX PHP Version: 4.1.2 New Comment: But if you turn the include into a normal file-system based include as I illustrated in my_include() then variables are maintained. Locally included files share the same scope as the script doing the inclusion. I see no use for what you are asking for, sorry. Previous Comments: ------------------------------------------------------------------------ [2002-06-26 15:33:58] code@4arrow.com Its just a feature request not a direct order. The feature request is not how to do includes but rather how to maintain the integrity of variable scopes when including a new http header request (while wanting all those new variables) inside an existing header request (while maintaining all those existing variables into the new header request). This is not something you can code hack to replicate it is an intrinsic sub request or child process that would establish user defined optional prefix based env variable differentials. ------------------------------------------------------------------------ [2002-06-26 15:25:08] rasmus@php.net Oh, I understand what you are asking for, it just still makes absolutely no sense to me. Why would you incur the overhead of an unneccesary HTTP request just for code flow? Wrap your include function yourself then. function my_include($url) { $a = parse_url($url); if($a['host'] == $_SERVER['SERVER_NAME'] { $file = $_SERVER['DOCUMENT_ROOT'].$a['path']; } else $file = $url; include $file; } my_include('http://localdomain/file.php'); That's all. Building this into PHP doesn't make any sense to me. ------------------------------------------------------------------------ [2002-06-26 15:15:59] code@4arrow.com Specifically, for me as I said it is about code flow and options. Really as simple as that. Having the ability to include a file with its full URI that makes a new header request without losing variable scope (locally) of the previous header request it is inside of would be beneficial to me and my php development by allowing me to gain more freedom and options. Options I think is the key word that this would create for me. Variables give me options losing them in middle of a run takes away my options. If there were to be any considertion for something like this, I would suggest a PREFIX optional argument that would prepend the newly created ENV variables from the new and second header request within the same domain. Maybe you're not clear on what I am suggesting. I am requesting the ability to include a full URL and a new header request within an existing header request on the same domain, same script execution run, that enables me to have two or more sets of unique and shared variables without losing variable scope. ------------------------------------------------------------------------ [2002-06-26 15:03:57] rasmus@php.net But you still haven't answered why you are doing: include 'http://samedomain/file.php'; This makes no sense to me. Why go through HTTP when the file is local? ------------------------------------------------------------------------ [2002-06-26 15:00:31] code@4arrow.com You're right about the additional load it would add and yes you can pass variables via the Query string. For me the feature request is more technical in nature than cosmetic patches will cover. When you execute a script and during its run I include'http://samedomain/file.php' There are limitations of scope that are placed on the included local file in comparison to its parent file which to me seems unecessary. This ruins the code flow for me, practically and mentally. I wonder if this is part of the child process limitation in PHP? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/18000 -- Edit this bug report at http://bugs.php.net/?id=18000&edit=1

« previous php.bugs (#12163) next »