Collapse
Submit a Service Request
Contact Information for Technical Support
My Service Notifications
Min length not met: value 0 < 1 minimum length
Answer ID 11230 |
Last Review Date 11/08/2019
Why do I get an error when assigning an empty string to a nullable text field in CPHP code?
Environment:
Connect for PHP (CPHP) API
Resolution:
When using the CPHP API, assignments made to object fields that are defined as nullable can be assigned the value of null, but not an empty string. If an empty string ("") is assigned you will receive an error indicating 'Min length not met: value 0 < 1 minimum length'. Different techniques to avoid assigning an empty string value can be employed in code, including checking for empty string ($var != "") before making assignments, or using default values in functions (function test($var="blank")) where assignments are made.