note 58423 added to function.system

From: Date: Thu, 03 Nov 2005 21:20:32 +0000
Subject: note 58423 added to function.system
Groups: php.notes 
Request: Send a blank email to php-notes+get-98038@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.system.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58423 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58423&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58423&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98038) next »