diff options
author | Joas Schilling <coding@schilljs.com> | 2018-01-26 10:25:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 10:25:09 +0100 |
commit | a7ad7cb08e80ba64bbd7199517a974ff27025558 (patch) | |
tree | d3af83c565c71954fa33fcdc02497c415df1d23c | |
parent | c2b1bd92d6f6e675f7ffab420cd61c5be701c4a6 (diff) | |
parent | e6efa755c9a8c6a6a4cc0faaffc23aea049d8298 (diff) | |
download | nextcloud-server-a7ad7cb08e80ba64bbd7199517a974ff27025558.tar.gz nextcloud-server-a7ad7cb08e80ba64bbd7199517a974ff27025558.zip |
Merge pull request #8053 from nextcloud/simplify-substr
Use short for of substr to not need strlen()
-rw-r--r-- | apps/files_versions/lib/Storage.php | 2 | ||||
-rw-r--r-- | lib/private/DB/Adapter.php | 2 | ||||
-rw-r--r-- | lib/private/DB/AdapterSqlite.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/template.php | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 6b8a441f7b3..d798312fda3 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -167,7 +167,7 @@ class Storage { // to get the right target $ext = pathinfo($filename, PATHINFO_EXTENSION); if ($ext === 'part') { - $filename = substr($filename, 0, strlen($filename) - 5); + $filename = substr($filename, 0, -5); } // we only handle existing files diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php index 3123a1b0d53..e88e3cf09c6 100644 --- a/lib/private/DB/Adapter.php +++ b/lib/private/DB/Adapter.php @@ -108,7 +108,7 @@ class Adapter { $query .= ' = ? AND '; } } - $query = substr($query, 0, strlen($query) - 5); + $query = substr($query, 0, -5); $query .= ' HAVING COUNT(*) = 0'; return $this->conn->executeUpdate($query, $inserts); diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index 5507699c54a..dbeec9ded43 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -79,7 +79,7 @@ class AdapterSqlite extends Adapter { $query .= ' = ? AND '; } } - $query = substr($query, 0, strlen($query) - 5); + $query = substr($query, 0, -5); $query .= ')'; return $this->conn->executeUpdate($query, $inserts); diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index e3365ca455f..c5279bff6b8 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -132,7 +132,7 @@ class OC_Template extends \OC\Template\Base { foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) { //remove trailing ".js" as addVendorScript will append it OC_Util::addVendorScript( - substr($vendorLibrary, 0, strlen($vendorLibrary) - 3),null,true); + substr($vendorLibrary, 0, -3),null,true); } } else { throw new \Exception('Cannot read core/js/core.json'); |