Skip to content

Fix passing null to parameter error, and avoids array to string conve…#79

Open
GaryHaddon wants to merge 1 commit intomagepal:masterfrom
GaryHaddon:master
Open

Fix passing null to parameter error, and avoids array to string conve…#79
GaryHaddon wants to merge 1 commit intomagepal:masterfrom
GaryHaddon:master

Conversation

@GaryHaddon
Copy link

…rsion error if data is an array.

public function escapeReturn($data)
{
return trim(str_replace(["\r\n", "\r", "\n"], ' ', $data));
if (!is_null($data) && !is_array($data)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GaryHaddon ... why not

return is_string($data) ? trim(str_replace(["\r\n", "\r", "\n"], ' ', $data)) : $data;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srenon either works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants