Home » Database » DB_DataObject » Bug #5817
Validation fails for DB_DataObject_Cast objects
Details
| Submitted | 2005-10-28 21:12 UTC |
|---|---|
| From | deckhoff at valetpay dot com |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.4.0 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-10-28 21:12 UTC] deckhoff at valetpay dot com
Description:
------------
During validation, DB_DataObject does not properly extract the value from fields set with a DB_DataObject_Cast.
Test script:
---------------
The following:
$user = DB_DataObject::staticGet('DO_User',$userId);
$user->affiliateId = DB_DataObject_Cast::sql('NULL');
$user->validate();
Fails with:
Error code: 2
Error message: preg_match() expects parameter 2 to be string, object given
File: /usr/share/pear/Validate.php
Line: 95
Context: Array
Expected result:
----------------
Validation should pull the value from the DB_DataObject_Cast object and then check table configuration to see if a NULL value is allowed for this field. If the field is allowed to be null, then the validation should return true.
Actual result:
--------------
Error code: 2
Error message: preg_match() expects parameter 2 to be string, object given
File: /usr/share/pear/Validate.php
Line: 95
Context: Array