mirror of
https://github.com/silverstripe/silverstripe-restfulserver
synced 2024-10-22 14:05:58 +02:00
FIX Add protection against deprecated warning from mb_check_encoding()
When the `$fieldValue` is not set, the `mb_check_encoding()` function raises a deprecation warning. ``` [Deprecated] mb_check_encoding(): Calling mb_check_encoding() without argument is deprecated ``` So we make sure the field value is set before using it.
This commit is contained in:
parent
3a3fd02367
commit
3d94e90a49
@ -126,7 +126,7 @@ class XMLDataFormatter extends DataFormatter
|
||||
continue;
|
||||
}
|
||||
$fieldValue = $obj->obj($fieldName)->forTemplate();
|
||||
if (!mb_check_encoding($fieldValue, 'utf-8')) {
|
||||
if (isset($fieldValue) && !mb_check_encoding($fieldValue, 'utf-8')) {
|
||||
$fieldValue = "(data is badly encoded)";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user