[PEPr] Comment on RFC::EvalForbiddance
| From: | Clay Loveless | Date: | Tue, 16 Aug 2005 14:06:11 +0000 |
| Subject: | [PEPr] Comment on RFC::EvalForbiddance | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39412@lists.php.net to get a copy of this message | ||
Clay Loveless (http://pear.php.net/user/clay) has commented on the proposal for
RFC::EvalForbiddance.
Comment:
This seems like a good idea in general, but there are cases where eval is
the only way to go -- such as this snippet to simultaneously avoid is_a()
deprecation notices in PHP5, and parse errors in PHP4:
$is_a = false;
$major_php_version = PHP_VERSION;
if (intval($major_php_version{0}) < 5) {
if (is_a($obj, 'some_class')) {
$is_a = true;
}
} else {
$is_a = eval("return ($obj instanceof Some_Class) ? true : false;");
}
It seems like this type of usage should be allowable -- no external data
is being handed off to eval() in this example, making it pretty safe
usage.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=288
--
Sent by PEPr, the automatic proposal system at http://pear.php.net