Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-07-01 02:44:33 +0300
committerLukas Reschke <lukas@owncloud.com>2015-07-01 17:51:45 +0300
commit7ec91b91775ca1419f7901a3edc399b06fe41b63 (patch)
treebfa63e682a506d6b595a03eb47972d64196eb71a /lib
parentf8e6800cd4a7350d73ce5a70b008d66b57ac3bd5 (diff)
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')
-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 1ebad2db770..6c38cdb8223 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -1227,17 +1227,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;