summaryrefslogtreecommitdiffstats
path: root/lib/private/app.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-07-01 01:44:33 +0200
committerLukas Reschke <lukas@owncloud.com>2015-07-01 01:44:33 +0200
commitaff55347f96e1cf990a4871bc69dafaaebf490f6 (patch)
tree9cf8ea01559b60ff634eabde8d3546e139397e65 /lib/private/app.php
parent16ff6cff54768c15f126e523d195a6993e0e2aea (diff)
downloadnextcloud-server-aff55347f96e1cf990a4871bc69dafaaebf490f6.tar.gz
nextcloud-server-aff55347f96e1cf990a4871bc69dafaaebf490f6.zip
Use UTF-8 mode for preg_split and preg_replace
Otherwise a single application with a description containing a non compliant character can break the whole ownCloud appstore. This is for example https://apps.owncloud.com/content/show.php?content=149553 Fixes https://github.com/owncloud/core/issues/17101#issuecomment-117365224
Diffstat (limited to 'lib/private/app.php')
-rw-r--r--lib/private/app.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index c506be1799b..1a32fcfcf77 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -1228,17 +1228,18 @@ class OC_App {
// manages line breaks itself
// first of all we split on empty lines
- $paragraphs = preg_split("!\n[[:space:]]*\n!m", $data['description']);
+ $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:]]+!m', ' ', $value));
+ $result[] = trim(preg_replace('![[:space:]]+!mu', ' ', $value));
}
// join the single paragraphs with a empty line in between
$data['description'] = implode("\n\n", $result);
+
}
return $data;