Re: [PHP] variable scoping...

2002-04-13 Thread Aric Caley

unfortunately, this doesnt seem to work.  Rather, it works, but it doesnt
seem to work any differently than an include() (although you can't use
output buffering on it, so in that regard its different).  It seems to pass
in all the variables and classes.

My other option, which I have been avoiding, is to rename the classes... not
all that hard really; and then for variables either rename them all, or do
this:

backupallglobalvariablesandunsetthem();
setvariablesthatscriptisexpectingtosee();
include("script");
unsetallvariablesnotinbackup();
restorebackupvariables();

and then repeat this for each script I'm trying to embed...
basicaly wrap each script/application in a clean "sterilized" php
envirionment.

I dont know how much overhead this would add.  But it seems like the only
solution at this point.  It just occured to me that this might actualy make
things more secure in a way since the parent script will totaly control what
variables get passed in..

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The documentation is outdated.  That restriction has been lifted as of PHP
> version 4.0.6.
>
> (cc'ing phpdoc to fix)
>
> -Rasmus
>
> On Fri, 12 Apr 2002, Aric Caley wrote:
>
> > but the virtual() documentation says you can't use it on a php script?
> >
> > "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I guess the only real way is to use virtual() in this case.  That's a
bit
> > > clunky as well, but it isn't quite as bad as going through CGI or all
the
> > > way out to the port 80 level.
> > >
> > > -Rasmus
> > >
> > > On Fri, 12 Apr 2002, Aric Caley wrote:
> > >
> > > > Is it possible to keep the variable name-space separate between,
say,
> > two
> > > > files (one included into the other) to avoid name collisions?  I'm
> > trying to
> > > > get two scripts to work together on the same page.  Each script
defines
> > some
> > > > classes that have the same names but work differently (ex., class
> > Template).
> > > > All I need is to embed the output of one script into the other.
> > > >
> > > > Now, I could do this by just getting the output from a URL but that
> > seems
> > > > really inefficient.  Or I could run the script from the CGI version
of
> > PHP
> > > > using exec() but that also seems like it could be really slow and
> > clunky.
> > > >
> > > > Is there some efficient way of doing this?
> > > >
> > > > It would be cool if you could just put the include() inside of a
> > function
> > > > and have all the classes and variable names be local inside that
> > function
> > > > but that didnt seem to work...  plus the scripts explicitly access
> > global
> > > > variable names.
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] variable scoping...

2002-04-12 Thread Rasmus Lerdorf

The documentation is outdated.  That restriction has been lifted as of PHP
version 4.0.6.

(cc'ing phpdoc to fix)

-Rasmus

On Fri, 12 Apr 2002, Aric Caley wrote:

> but the virtual() documentation says you can't use it on a php script?
>
> "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I guess the only real way is to use virtual() in this case.  That's a bit
> > clunky as well, but it isn't quite as bad as going through CGI or all the
> > way out to the port 80 level.
> >
> > -Rasmus
> >
> > On Fri, 12 Apr 2002, Aric Caley wrote:
> >
> > > Is it possible to keep the variable name-space separate between, say,
> two
> > > files (one included into the other) to avoid name collisions?  I'm
> trying to
> > > get two scripts to work together on the same page.  Each script defines
> some
> > > classes that have the same names but work differently (ex., class
> Template).
> > > All I need is to embed the output of one script into the other.
> > >
> > > Now, I could do this by just getting the output from a URL but that
> seems
> > > really inefficient.  Or I could run the script from the CGI version of
> PHP
> > > using exec() but that also seems like it could be really slow and
> clunky.
> > >
> > > Is there some efficient way of doing this?
> > >
> > > It would be cool if you could just put the include() inside of a
> function
> > > and have all the classes and variable names be local inside that
> function
> > > but that didnt seem to work...  plus the scripts explicitly access
> global
> > > variable names.
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] variable scoping...

2002-04-12 Thread Aric Caley

but the virtual() documentation says you can't use it on a php script?

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I guess the only real way is to use virtual() in this case.  That's a bit
> clunky as well, but it isn't quite as bad as going through CGI or all the
> way out to the port 80 level.
>
> -Rasmus
>
> On Fri, 12 Apr 2002, Aric Caley wrote:
>
> > Is it possible to keep the variable name-space separate between, say,
two
> > files (one included into the other) to avoid name collisions?  I'm
trying to
> > get two scripts to work together on the same page.  Each script defines
some
> > classes that have the same names but work differently (ex., class
Template).
> > All I need is to embed the output of one script into the other.
> >
> > Now, I could do this by just getting the output from a URL but that
seems
> > really inefficient.  Or I could run the script from the CGI version of
PHP
> > using exec() but that also seems like it could be really slow and
clunky.
> >
> > Is there some efficient way of doing this?
> >
> > It would be cool if you could just put the include() inside of a
function
> > and have all the classes and variable names be local inside that
function
> > but that didnt seem to work...  plus the scripts explicitly access
global
> > variable names.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] variable scoping...

2002-04-12 Thread Rasmus Lerdorf

I guess the only real way is to use virtual() in this case.  That's a bit
clunky as well, but it isn't quite as bad as going through CGI or all the
way out to the port 80 level.

-Rasmus

On Fri, 12 Apr 2002, Aric Caley wrote:

> Is it possible to keep the variable name-space separate between, say, two
> files (one included into the other) to avoid name collisions?  I'm trying to
> get two scripts to work together on the same page.  Each script defines some
> classes that have the same names but work differently (ex., class Template).
> All I need is to embed the output of one script into the other.
>
> Now, I could do this by just getting the output from a URL but that seems
> really inefficient.  Or I could run the script from the CGI version of PHP
> using exec() but that also seems like it could be really slow and clunky.
>
> Is there some efficient way of doing this?
>
> It would be cool if you could just put the include() inside of a function
> and have all the classes and variable names be local inside that function
> but that didnt seem to work...  plus the scripts explicitly access global
> variable names.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] variable scoping...

2002-04-12 Thread Aric Caley

Is it possible to keep the variable name-space separate between, say, two
files (one included into the other) to avoid name collisions?  I'm trying to
get two scripts to work together on the same page.  Each script defines some
classes that have the same names but work differently (ex., class Template).
All I need is to embed the output of one script into the other.

Now, I could do this by just getting the output from a URL but that seems
really inefficient.  Or I could run the script from the CGI version of PHP
using exec() but that also seems like it could be really slow and clunky.

Is there some efficient way of doing this?

It would be cool if you could just put the include() inside of a function
and have all the classes and variable names be local inside that function
but that didnt seem to work...  plus the scripts explicitly access global
variable names.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php