Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M2-97 - Fixed some "Passing null to parameter of type string is depre… #27

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Model/Request/SubModel/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function toArray()
}
} else {
if (key_exists('cdata', $fieldSettings)) { // If value should be encapsulated inside CDATA tag
if (function_exists('mb_detect_encoding') && !mb_detect_encoding($fieldSettings['value'], 'UTF-8', true)) { // Check only if php mdstring extension is loaded
if (function_exists('mb_detect_encoding') && is_string($fieldSettings['value']) && !mb_detect_encoding($fieldSettings['value'], 'UTF-8', true)) { // Check only if php mdstring extension is loaded
throw new ModelException("Value of '" . $fieldName . "' has to be encoded in UTF-8");
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Service/SimpleXmlExtended.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public function addCDataChild($sName, $sValue)
*/
private function removeSpecialChars($str)
{
if (!is_string($str)) {
return '';
}

$search = ['–', '´', '‹', '›', '‘', '’', '‚', '“', '”', '„', '‟', '•', '‒', '―', '—', '™', '¼', '½', '¾'];
$replace = ['-', "'", '<', '>', "'", "'", ',', '"', '"', '"', '"', '-', '-', '-', '-', 'TM', '1/4', '1/2', '3/4'];

Expand Down