diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-07-01 15:44:21 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-01 15:44:21 +0200 |
commit | bad499baadf0ef7210106963b0720742b50d9796 (patch) | |
tree | 397e064efd326a580134cb69c8fcc0193cdc668d /lib/private | |
parent | 709eca20854c60a41ac811854174a6e883b8f770 (diff) | |
parent | aae55174f69dd1e079f7c79323469189b902f1e9 (diff) | |
download | nextcloud-server-bad499baadf0ef7210106963b0720742b50d9796.tar.gz nextcloud-server-bad499baadf0ef7210106963b0720742b50d9796.zip |
Merge pull request #17252 from owncloud/fix-php-errors-in-app-description
Only do the description kung-fu on strings
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/app.php | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index 1a32fcfcf77..d5e07ffdbcc 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -1223,23 +1223,27 @@ class OC_App { // just modify the description if it is available // otherwise this will create a $data element with an empty 'description' if (isset($data['description'])) { - // sometimes the description contains line breaks and they are then also - // shown in this way in the app management which isn't wanted as HTML - // manages line breaks itself - - // first of all we split on empty lines - $paragraphs = preg_split("!\n[[:space:]]*\n!mu", $data['description']); - - $result = []; - foreach ($paragraphs as $value) { - // replace multiple whitespace (tabs, space, newlines) inside a paragraph - // with a single space - also trims whitespace - $result[] = trim(preg_replace('![[:space:]]+!mu', ' ', $value)); - } + if (is_string($data['description'])) { + // sometimes the description contains line breaks and they are then also + // shown in this way in the app management which isn't wanted as HTML + // manages line breaks itself + + // first of all we split on empty lines + $paragraphs = preg_split("!\n[[:space:]]*\n!mu", $data['description']); + + $result = []; + foreach ($paragraphs as $value) { + // replace multiple whitespace (tabs, space, newlines) inside a paragraph + // with a single space - also trims whitespace + $result[] = trim(preg_replace('![[:space:]]+!mu', ' ', $value)); + } - // join the single paragraphs with a empty line in between - $data['description'] = implode("\n\n", $result); + // join the single paragraphs with a empty line in between + $data['description'] = implode("\n\n", $result); + } else { + $data['description'] = ''; + } } return $data; |