[Solar-talk] db exception on size exceeded

Jeff Surgeson solar at 3hex.com
Sun Jul 16 16:14:01 PDT 2006


Hi Paul

If the amount of of the user input exceeds the size value (255) as shown below 
a exception is thrown. "Vendor_Model_Metals -- ERR_INVALID_DATA" in the pink 
feedback message block at top of page. It also generates a warning at the 
same time which I am not sure has anything to do with it but will show it 
just in case it means anything to you.

Warning: htmlspecialchars() expects parameter 1 to be string, array given 
in /var/www/localhost/htdocs/library/Solar/View.php on line 395

I might be wrong but should it not just truncate the data to the field size 
and not error out/throw exception?
Or is there a way to use a validation rule so that it returns some feedback so 
the person knows which field is creating the problem?

Of course I can just make it a "clob" data type but thats not realy the 
solution.

$this->_col['perform_bond'] = array(
	'type'    => 'varchar',
        'size'    => 255,
        'require' => true,
        'valid' => array('multiple', 'VALID_TEXT',
        	array(
                    array('notBlank'),
                    array('regex', '/^[[:alpha:][:digit:][:punct:]\s]+$/'),
                )
        ),
);

-- 
Jeff Surgeson


More information about the solar-talk mailing list