note 105135 deleted from function.extract by danbrown
| From: | danbrown@php.net | Date: | Fri, 29 Jul 2011 21:30:45 +0000 |
| Subject: | note 105135 deleted from function.extract by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182007@lists.php.net to get a copy of this message | ||
Note Submitter: Rodrigo
----
There is something I don't Understand, if somebody develops all his codes by himself, how come
you can duplicate variable names?
So if this the case, you can use extract() in a safe way, because you already know what and where
are your variables in your code.
Even if you don't use extract, you can by accident overwrite, you can "emulate" the
use of extract like this:
<?php
/*asuming I got from a POST form the next variables
$_POST["some"], $_POST["other"] */
//So if I use extract,
extract($_POST);
//I got $some and $other
//But if I do this...
$some = $_POST["some"];
$other = $_POST["other"];
//I got the same result, two variables with the names $some and $other,
?>
So, the problem persist, I got two variables that in any case could be overwritten by accident, so I
really don't see the trouble extract() may cause,
Although, if you are a part of a group of programmers working in the same proyect, probably,
extract() could cause security troubles.