Re: Experience/Function Aliases (Was:Re: [PHP-DEV] PHP FileUpload Security Hole - Still No Fix?
| From: | Zak Greant | Date: | Thu, 07 Sep 2000 06:35:28 +0000 |
| Subject: | Re: Experience/Function Aliases (Was:Re: [PHP-DEV] PHP FileUpload Security Hole - Still No Fix? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-32492@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Ron Chmara" <ron@Opus1.COM>
To: "Zak Greant" <zak@freeimages.com>
Cc: <php-dev@lists.php.net>
Sent: Wednesday, September 06, 2000 11:53 PM
Subject: Re: [PHP-DEV] Experience/Function Aliases (Was:Re:
[PHP-DEV] PHP FileUpload Security Hole - Still No Fix?
> Zak Greant wrote:
> > > Such as:
> > > myaliases.inc----
> > > /* may need to put some special "flag" char in front
> > > * so they are picked up easily, such as ~, as in
> > "~htment()"
> > > */
> > > alias (htmlentities, htment)
> > > alias (get_html_translation_table, ghtt)
> > > alias (quoted_printable_decode, qpd)
> >
> > :) Ah, the feature already (sort-of) exists:
> >
> > $htmlent = 'htmlentities';
> > print $htmlent ('" should be converted to " &
should be
> > converted to &');
>
> Hm. A page filled with print statements? And what about
aliasing:
>
> alias (print, pr);
> alias (echo, ec); // my most used function, one less char
than print.
>
> An amusing recursion happens:
>
> $ec = 'echo';
> $pr = 'print';
> print $pr ("hello, world"); /* Heh. */
> print $ec ("hello, world");
>
> Even with two letter function aliases, it still adds 7
chars to
> typing every function (print $).... which doesn't really
help
> to shorten function calling if you're trying to shorten a
9
> char function (let alone a 4-5 char function) down....
errrr... no :o) I should have been more explicit.
If php sees a variable in front of parenthesis, it uses the
value stored in the variable as a function name.
This interpolation works with functions - but does not work
with language constructs like print, echo or array.
Also, you cannot do this interpolation using constants.
i.e.
<?
$pf = 'printf';
$pf ('test'); # works
$_ = 'print';
$_ 'test'; # chokes
?>
Zak