note 105135 added to function.extract

From: Date: Fri, 29 Jul 2011 15:36:55 +0000
Subject: note 105135 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-181996@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 189.135.76.174 ---- Manual Page -- http://www.php.net/manual/en/function.extract.php Edit -- https://master.php.net/note/edit/105135 Del: integrated -- https://master.php.net/note/delete/105135/integrated Del: useless -- https://master.php.net/note/delete/105135/useless Del: bad code -- https://master.php.net/note/delete/105135/bad+code Del: spam -- https://master.php.net/note/delete/105135/spam Del: non-english -- https://master.php.net/note/delete/105135/non-english Del: in docs -- https://master.php.net/note/delete/105135/in+docs Del: other reasons-- https://master.php.net/note/delete/105135 Reject -- https://master.php.net/note/reject/105135 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181996) next »