note 58423 deleted from function.system by cmb
| From: | cmb@php.net | Date: | Sun, 08 Dec 2019 11:44:53 +0000 |
| Subject: | note 58423 deleted from function.system by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213478@lists.php.net to get a copy of this message | ||
Note Submitter: cho at stunt growth dot com
----
Note to the persons who suggested using backticks for gathering a return value from scripts via
system().
Using Backticks is generally frowned upon for security sake. They can be exploited more easily.
Instead, why not use the exec() function with a return parameter specified as an array type. This
will allow you to take the full string returned from your script (for example rsync) and return each
line in an array.
like so:
$result = array();
exec( $cmd, &$result);
foreach ( $result as $v )
{
// parse, or do cool stuff
}
Hope this alternative brings you merriment.