cvs: pear /DB_Table/DB/Table Valid.php
| From: | Paul Jones | Date: | Mon, 08 Nov 2004 02:36:01 +0000 |
| Subject: | cvs: pear /DB_Table/DB/Table Valid.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-25753@lists.php.net to get a copy of this message | ||
pmjones Sun Nov 7 21:36:01 2004 EDT
Modified files:
/pear/DB_Table/DB/Table Valid.php
Log:
Alex Hobart noted isChar() was too restrictive; we now check only that the value is scalar
(non-array non-object) and is in the allowed length range.
http://cvs.php.net/diff.php/pear/DB_Table/DB/Table/Valid.php?r1=1.3&r2=1.4&ty=u
Index: pear/DB_Table/DB/Table/Valid.php
diff -u pear/DB_Table/DB/Table/Valid.php:1.3 pear/DB_Table/DB/Table/Valid.php:1.4
--- pear/DB_Table/DB/Table/Valid.php:1.3 Sat Jul 10 11:07:55 2004
+++ pear/DB_Table/DB/Table/Valid.php Sun Nov 7 21:36:00 2004
@@ -22,7 +22,7 @@
*
* DB_Table_Valid validates values against DB_Table column types.
*
-* $Id: Valid.php,v 1.3 2004/07/10 15:07:55 pmjones Exp $
+* $Id: Valid.php,v 1.4 2004/11/08 02:36:00 pmjones Exp $
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
@@ -63,6 +63,8 @@
*
* Check if a value validates against the 'char' and 'varchar' data type.
*
+ * We allow most anything here, only checking that the length is in range.
+ *
* @static
*
* @access public
@@ -76,8 +78,9 @@
function isChar($value, $colsize)
{
+ $is_scalar = (! is_array($value) && ! is_object($value));
$in_range = (strlen($value) <= $colsize);
- return is_string($value) && $in_range;
+ return $is_scalar && $in_range;
}