cvs: pear /Net_FTP/Net FTP.php
| From: | Tobias Schlitt | Date: | Sun, 14 Mar 2004 13:51:45 +0000 |
| Subject: | cvs: pear /Net_FTP/Net FTP.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-17392@lists.php.net to get a copy of this message | ||
toby Sun Mar 14 08:51:45 2004 EDT
Modified files:
/pear/Net_FTP/Net FTP.php
Log:
* Added some input validation.
http://cvs.php.net/diff.php/pear/Net_FTP/Net/FTP.php?r1=1.12&r2=1.13&ty=u
Index: pear/Net_FTP/Net/FTP.php
diff -u pear/Net_FTP/Net/FTP.php:1.12 pear/Net_FTP/Net/FTP.php:1.13
--- pear/Net_FTP/Net/FTP.php:1.12 Sun Mar 14 08:25:45 2004
+++ pear/Net_FTP/Net/FTP.php Sun Mar 14 08:51:44 2004
@@ -14,7 +14,7 @@
// | Authors: Tobias Schlitt <toby@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: FTP.php,v 1.12 2004/03/14 13:25:45 toby Exp $
+// $Id: FTP.php,v 1.13 2004/03/14 13:51:44 toby Exp $
require_once 'PEAR.php';
@@ -889,12 +889,17 @@
* Set the Hostname
*
* @access public
- * @param string $host The Hostname to set
+ * @param string $host The Hostname to set
+ * @return bool True on success, otherwise PEAR::Error
*/
function setHostname($host)
{
+ if (!is_string($hostname)) {
+ return PEAR::raiseError("Hostname must be a string.", 0);
+ }
$this->_hostname = $host;
+ return true;
}
/**
@@ -902,11 +907,16 @@
*
* @access public
* @param int $port The Port to set
+ * @return bool True on success, otherwise PEAR::Error
*/
function setPort($port)
{
+ if (!is_int($port) || ($port < 0)) {
+ PEAR::raiseError("Invalid port. Has to be integer >= 0", 0);
+ }
$this->_port = $port;
+ return true;
}
/**