Why do I get an error when assigning an empty string to a nullable text field in CPHP code?
Connect for PHP (CPHP) API
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.