cvs: pear /Math_Stats Stats.php
| From: | Jesus M. Castagnetto | Date: | Thu, 16 May 2002 23:06:15 +0000 |
| Subject: | cvs: pear /Math_Stats Stats.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3880@lists.php.net to get a copy of this message | ||
jmcastagnetto Thu May 16 19:06:15 2002 EDT
Modified files:
/pear/Math_Stats Stats.php
Log:
Checking that data is an array to avoid "misteaks"
Index: pear/Math_Stats/Stats.php
diff -u pear/Math_Stats/Stats.php:1.4 pear/Math_Stats/Stats.php:1.5
--- pear/Math_Stats/Stats.php:1.4 Thu May 16 00:45:28 2002
+++ pear/Math_Stats/Stats.php Thu May 16 19:06:15 2002
@@ -16,7 +16,7 @@
// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Stats.php,v 1.4 2002/05/16 04:45:28 jmcastagnetto Exp $
+// $Id: Stats.php,v 1.5 2002/05/16 23:06:15 jmcastagnetto Exp $
//
include_once "PEAR.php";
@@ -171,6 +171,8 @@
function setData($arr, $opt=STATS_DATA_SIMPLE) {/*{{{*/
$this->_data = null;
$this->_dataOption = null;
+ if (!is_array($arr))
+ return PEAR::raiseError("invalid data, an array of numeric data was
expected");
if ($opt == STATS_DATA_SIMPLE) {
$this->_dataOption = $opt;
$this->_data = array_values($arr);