PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #5817

Validation fails for DB_DataObject_Cast objects

Details

Submitted2005-10-28 21:12 UTC
Fromdeckhoff at valetpay dot com
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.4.0
OSLinux
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