Minimum length not met: value 0 < 1 minimum length
这个问题出现在oracle使用 CPHP 这个函数中;
下面是官方解释:https://cx.rightnow.com/app/answers/detail/a_id/11230/~/min-length-not-met%3A-value-0-%3C-1-minimum-length
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.
翻译过来:
为什么在 CPHP 代码中将空字符串分配给可为空的文本字段时出现错误?
环境:
连接 PHP (CPHP) API
解决:
使用 CPHP API 时,对定义为可为空的对象字段所做的分配可以分配 null 值,但不能分配空字符串。如果分配了空字符串 (""),您将收到一条错误消息,指示“未满足最小长度:值 0 < 1 最小长度”。可以在代码中使用不同的技术来避免分配空字符串值,包括在进行分配之前检查空字符串 ($var != ""),或在函数中使用默认值(函数 test($var="blank"))进行分配的地方。
我真是想无力吐槽oracle~,踩过太多的坑了....