Fix PHP8.0 error (TypeError): strlen(): Argument #1 ($string) must be of type string, array given

This commit is contained in:
Hadi Nategh 2021-11-04 17:23:45 +01:00
parent dd42733393
commit 201d1f9972

View File

@ -632,7 +632,7 @@ class Base
{
continue; // no need to write that (unset) column
}
if ($this->table_def['fd'][$db_col]['type'] == 'varchar' &&
if ($this->table_def['fd'][$db_col]['type'] == 'varchar' && is_string($this->data[$col]) &&
strlen($this->data[$col]) > $this->table_def['fd'][$db_col]['precision'])
{
// truncate the field to mamimum length, if upper layers didn't care