Skip to content

Commit

Permalink
Fix EZP-21443: Debug log displayed when using long japaneese strings …
Browse files Browse the repository at this point in the history
…in name
  • Loading branch information
yannickroger committed Aug 23, 2013
1 parent d43db1d commit a185a03
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/classes/ezpersistentobject.php
Expand Up @@ -370,14 +370,14 @@ public static function storeObject( $obj, $fieldFilters = null )
$field_def['datatype'] === 'string' &&
array_key_exists( 'max_length', $field_def ) &&
$field_def['max_length'] > 0 &&
strlen( $value ) > $field_def['max_length'] )
mb_strlen( $value, "utf-8" ) > $field_def['max_length'] )
{
$obj->setAttribute( $field_name, substr( $value, 0, $field_def['max_length'] ) );
$obj->setAttribute( $field_name, mb_substr( $value, 0, $field_def['max_length'], "utf-8" ) );
eZDebug::writeDebug( $value, "truncation of $field_name to max_length=". $field_def['max_length'] );
}
$bindDataTypes = array( 'text' );
if ( $db->bindingType() != eZDBInterface::BINDING_NO &&
strlen( $value ) > 2000 &&
mb_strlen( $value, "utf-8" ) > 2000 &&
is_array( $field_def ) &&
in_array( $field_def['datatype'], $bindDataTypes )
)
Expand Down Expand Up @@ -1180,7 +1180,7 @@ public static function updateObjectList( $parameters )

$bindDataTypes = array( 'text' );
if ( $db->bindingType() != eZDBInterface::BINDING_NO &&
strlen( $value ) > 2000 &&
mb_strlen( $value, "utf-8" ) > 2000 &&
is_array( $fieldDef ) &&
in_array( $fieldDef['datatype'], $bindDataTypes )
)
Expand Down

0 comments on commit a185a03

Please sign in to comment.