Skip to content

Commit a7ad7cb

Browse files
Merge pull request nextcloud#8053 from nextcloud/simplify-substr
Use short for of substr to not need strlen()
2 parents c2b1bd9 + e6efa75 commit a7ad7cb

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

apps/files_versions/lib/Storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static function store($filename) {
167167
// to get the right target
168168
$ext = pathinfo($filename, PATHINFO_EXTENSION);
169169
if ($ext === 'part') {
170-
$filename = substr($filename, 0, strlen($filename) - 5);
170+
$filename = substr($filename, 0, -5);
171171
}
172172

173173
// we only handle existing files

lib/private/DB/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function insertIfNotExist($table, $input, array $compare = null) {
108108
$query .= ' = ? AND ';
109109
}
110110
}
111-
$query = substr($query, 0, strlen($query) - 5);
111+
$query = substr($query, 0, -5);
112112
$query .= ' HAVING COUNT(*) = 0';
113113

114114
return $this->conn->executeUpdate($query, $inserts);

lib/private/DB/AdapterSqlite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function insertIfNotExist($table, $input, array $compare = null) {
7979
$query .= ' = ? AND ';
8080
}
8181
}
82-
$query = substr($query, 0, strlen($query) - 5);
82+
$query = substr($query, 0, -5);
8383
$query .= ')';
8484

8585
return $this->conn->executeUpdate($query, $inserts);

lib/private/legacy/template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public static function initTemplateEngine($renderAs) {
132132
foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) {
133133
//remove trailing ".js" as addVendorScript will append it
134134
OC_Util::addVendorScript(
135-
substr($vendorLibrary, 0, strlen($vendorLibrary) - 3),null,true);
135+
substr($vendorLibrary, 0, -3),null,true);
136136
}
137137
} else {
138138
throw new \Exception('Cannot read core/js/core.json');

0 commit comments

Comments
 (0)