Re: Re: [PEPr] Comment on RFC::EvalForbiddance
| From: | Clay Loveless | Date: | Tue, 16 Aug 2005 16:46:50 +0000 |
| Subject: | Re: Re: [PEPr] Comment on RFC::EvalForbiddance | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39423@lists.php.net to get a copy of this message | ||
Pierre-Alain Joye (pierre@dotgeek.org) wrote:
> Again, you have no clue about what you are talking about. The patch
> was rejected and there is maybe a little chance to get is_a
> undeprecated in next RC.
I'm not talking about patches or release candidates.
> It's not a personnal attack, it's only an attempt to make you
> realize how most of comments are senseless.
A failed attempt, if you're referring to my comments. But if you're
referring to your comments ... Try the following:
Run this code in PHP4 *and in* PHP5:
<?php
require_once 'PEAR.php';
$p =& new PEAR;
// The following 3 lines will kill PHP4. Comment them out
// to test proper and safe eval() usage.
if (class_exists('pear') && $p instanceof PEAR) {
echo "We'd never reach this line with PHP4.";
}
$is_a = false;
$major_php_version = PHP_VERSION;
if (intval($major_php_version{0}) < 5) {
if (is_a($p, 'pear')) {
$is_a = true;
}
} else {
$is_a = eval("return (\$p instanceof PEAR) ? true : false;");
if ($p instanceof PEAR) {
$is_a = true;
}
}
// Safe detection with PHP4 _and_ PHP5.
if ($is_a) {
echo "neato, a PEAR object!\n";
}
?>
There you go, a valid use case for eval().
--
Killersoft.com