diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-25 23:06:53 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-26 11:35:42 +0100 |
commit | c1e4f9f30563d5eda1718d716d631d6092cd4e28 (patch) | |
tree | 3bb7b6ef891cd80895d4c2c92252a4ccbc0c0cee | |
parent | fe7e726ab228e6ddde7cf1442de9d0db193334a1 (diff) | |
download | nextcloud-server-c1e4f9f30563d5eda1718d716d631d6092cd4e28.tar.gz nextcloud-server-c1e4f9f30563d5eda1718d716d631d6092cd4e28.zip |
Use type casting instead of *val() method
It should be up to 6x faster
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
30 files changed, 62 insertions, 62 deletions
diff --git a/apps/comments/appinfo/app.php b/apps/comments/appinfo/app.php index 15c545ae1e4..109063cd22e 100644 --- a/apps/comments/appinfo/app.php +++ b/apps/comments/appinfo/app.php @@ -36,7 +36,7 @@ $eventDispatcher->addListener( $eventDispatcher->addListener(\OCP\Comments\CommentsEntityEvent::EVENT_ENTITY, function(\OCP\Comments\CommentsEntityEvent $event) { $event->addEntityCollection('files', function($name) { - $nodes = \OC::$server->getUserFolder()->getById(intval($name)); + $nodes = \OC::$server->getUserFolder()->getById((int)$name); return !empty($nodes); }); }); diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php index 5fc38315438..bac661b6722 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php @@ -40,6 +40,6 @@ class LimitFilter implements XmlDeserializable { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value'); } - return intval($value); + return (int)$value; } }
\ No newline at end of file diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php index 7aac59809a2..8ced850bbc0 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php @@ -40,6 +40,6 @@ class OffsetFilter implements XmlDeserializable { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); } - return intval($value); + return (int)$value; } }
\ No newline at end of file diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php index ac625c3a9a4..58469d27205 100644 --- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php @@ -97,7 +97,7 @@ class CommentPropertiesPlugin extends ServerPlugin { } $propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node) { - return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId())); + return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId()); }); $propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node) { @@ -153,9 +153,9 @@ class CommentPropertiesPlugin extends ServerPlugin { return null; } - $lastRead = $this->commentsManager->getReadMark('files', strval($node->getId()), $user); + $lastRead = $this->commentsManager->getReadMark('files', (string)$node->getId(), $user); - return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId()), $lastRead); + return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead); } } diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index b8a8209129c..fd237b604a9 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -369,7 +369,7 @@ abstract class Node implements \Sabre\DAV\INode { throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).'); } - return intval($mtimeFromRequest); + return (int)$mtimeFromRequest; } } diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php index c76ab832b14..eb4b3a7c9e6 100644 --- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php @@ -60,7 +60,7 @@ class SystemTagsRelationsCollection extends SimpleCollection { $userSession, $groupManager, function($name) { - $nodes = \OC::$server->getUserFolder()->getById(intval($name)); + $nodes = \OC::$server->getUserFolder()->getById((int)$name); return !empty($nodes); } ), diff --git a/apps/files_external/3rdparty/icewind/smb/src/Parser.php b/apps/files_external/3rdparty/icewind/smb/src/Parser.php index 3142f9c29e0..c6515002657 100644 --- a/apps/files_external/3rdparty/icewind/smb/src/Parser.php +++ b/apps/files_external/3rdparty/icewind/smb/src/Parser.php @@ -133,7 +133,7 @@ class Parser { return [ 'mtime' => strtotime($data['write_time']), 'mode' => hexdec(substr($data['attributes'], strpos($data['attributes'], '('), -1)), - 'size' => isset($data['stream']) ? intval(explode(' ', $data['stream'])[1]) : 0 + 'size' => isset($data['stream']) ? (int)explode(' ', $data['stream'])[1] : 0 ]; } diff --git a/apps/files_trashbin/lib/Expiration.php b/apps/files_trashbin/lib/Expiration.php index 03f126fc415..c7ad4e29f18 100644 --- a/apps/files_trashbin/lib/Expiration.php +++ b/apps/files_trashbin/lib/Expiration.php @@ -142,13 +142,13 @@ class Expiration { $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue === 'auto') { // Keep for X days but delete anytime if space needed - $this->minAge = intval($minValue); + $this->minAge = (int)$minValue; $this->maxAge = self::NO_OBLIGATION; $this->canPurgeToSaveSpace = true; } elseif ($minValue === 'auto' && $maxValue !== 'auto') { // Delete anytime if space needed, Delete all older than max automatically $this->minAge = self::NO_OBLIGATION; - $this->maxAge = intval($maxValue); + $this->maxAge = (int)$maxValue; $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue !== 'auto') { // Delete all older than max OR older than min if space needed @@ -158,8 +158,8 @@ class Expiration { $maxValue = $minValue; } - $this->minAge = intval($minValue); - $this->maxAge = intval($maxValue); + $this->minAge = (int)$minValue; + $this->maxAge = (int)$maxValue; $this->canPurgeToSaveSpace = false; } } diff --git a/apps/files_versions/lib/Expiration.php b/apps/files_versions/lib/Expiration.php index 1dad8801230..83195d10a30 100644 --- a/apps/files_versions/lib/Expiration.php +++ b/apps/files_versions/lib/Expiration.php @@ -175,13 +175,13 @@ class Expiration { $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue === 'auto') { // Keep for X days but delete anytime if space needed - $this->minAge = intval($minValue); + $this->minAge = (int)$minValue; $this->maxAge = self::NO_OBLIGATION; $this->canPurgeToSaveSpace = true; } elseif ($minValue === 'auto' && $maxValue !== 'auto') { // Delete anytime if space needed, Delete all older than max automatically $this->minAge = self::NO_OBLIGATION; - $this->maxAge = intval($maxValue); + $this->maxAge = (int)$maxValue; $this->canPurgeToSaveSpace = true; } elseif ($minValue !== 'auto' && $maxValue !== 'auto') { // Delete all older than max OR older than min if space needed @@ -191,8 +191,8 @@ class Expiration { $maxValue = $minValue; } - $this->minAge = intval($minValue); - $this->maxAge = intval($maxValue); + $this->minAge = (int)$minValue; + $this->maxAge = (int)$maxValue; $this->canPurgeToSaveSpace = false; } } diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index d798312fda3..f8a6636839a 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -503,7 +503,7 @@ class Storage { $toDelete = []; foreach (array_reverse($versions['all']) as $key => $version) { - if (intval($version['version'])<$threshold) { + if ((int)$version['version'] <$threshold) { $toDelete[$key] = $version; } else { //Versions are sorted by time - nothing mo to iterate. diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index d65e9add563..c0c81be14d7 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -32,7 +32,7 @@ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); $serverConnections = $helper->getServerConfigurationPrefixes(); sort($serverConnections); $lk = array_pop($serverConnections); -$ln = intval(str_replace('s', '', $lk)); +$ln = (int)str_replace('s', '', $lk); $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT); $resultData = array('configPrefix' => $nk); diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index ae61bfcd41c..c81b8d54696 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -109,8 +109,8 @@ class Search extends Command { $configPrefixes = $helper->getServerConfigurationPrefixes(true); $ldapWrapper = new LDAP(); - $offset = intval($input->getOption('offset')); - $limit = intval($input->getOption('limit')); + $offset = (int)$input->getOption('offset'); + $limit = (int)$input->getOption('limit'); $this->validateOffsetAndLimit($offset, $limit); if($input->getOption('group')) { diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index c73a35e6bf1..25d3f66c52d 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -106,7 +106,7 @@ class Connection extends LDAPUtility { $this->doNotValidate = !in_array($this->configPrefix, $helper->getServerConfigurationPrefixes()); $this->hasPagedResultSupport = - intval($this->configuration->ldapPagingSize) !== 0 + (int)$this->configuration->ldapPagingSize !== 0 || $this->ldap->hasPagedResultSupport(); } @@ -368,7 +368,7 @@ class Connection extends LDAPUtility { } } - $backupPort = intval($this->configuration->ldapBackupPort); + $backupPort = (int)$this->configuration->ldapBackupPort; if ($backupPort <= 0) { $this->configuration->backupPort = $this->configuration->ldapPort; } @@ -399,7 +399,7 @@ class Connection extends LDAPUtility { private function doCriticalValidation() { $configurationOK = true; $errorStr = 'Configuration Error (prefix '. - strval($this->configPrefix).'): '; + (string)$this->configPrefix .'): '; //options that shall not be empty $options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName', diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index 54800ef24eb..e000bd4e709 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -285,7 +285,7 @@ class ConfigAPIController extends OCSController { $config = new Configuration($configID); $data = $config->getConfiguration(); - if(!boolval(intval($showPassword))) { + if(!(int)$showPassword) { $data['ldapAgentPassword'] = '***'; } foreach ($data as $key => $value) { diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 3faa96bc2b8..6a2be770104 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -266,7 +266,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD $groups = $this->access->groupsMatchFilter($groups); $allGroups = $groups; $nestedGroups = $this->access->connection->ldapNestedGroups; - if (intval($nestedGroups) === 1) { + if ((int)$nestedGroups === 1) { foreach ($groups as $group) { $subGroups = $this->_getGroupDNsFromMemberOf($group, $seen); $allGroups = array_merge($allGroups, $subGroups); @@ -667,8 +667,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD // if possible, read out membership via memberOf. It's far faster than // performing a search, which still is a fallback later. // memberof doesn't support memberuid, so skip it here. - if(intval($this->access->connection->hasMemberOfFilterSupport) === 1 - && intval($this->access->connection->useMemberOfToDetectMembership) === 1 + if((int)$this->access->connection->hasMemberOfFilterSupport === 1 + && (int)$this->access->connection->useMemberOfToDetectMembership === 1 && strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid' ) { $groupDNs = $this->_getGroupDNsFromMemberOf($userDN); diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php index 3d1ae31cfef..f7794168760 100644 --- a/apps/user_ldap/lib/Helper.php +++ b/apps/user_ldap/lib/Helper.php @@ -122,7 +122,7 @@ class Helper { sort($serverConnections); $lastKey = array_pop($serverConnections); - $lastNumber = intval(str_replace('s', '', $lastKey)); + $lastNumber = (int)str_replace('s', '', $lastKey); return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT); } diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index 849c30ecd65..14682c65ce1 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -69,8 +69,8 @@ class CleanUp extends TimedJob { public function __construct() { $minutes = \OC::$server->getConfig()->getSystemValue( - 'ldapUserCleanupInterval', strval($this->defaultIntervalMin)); - $this->setInterval(intval($minutes) * 60); + 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin); + $this->setInterval((int)$minutes * 60); } /** @@ -183,7 +183,7 @@ class CleanUp extends TimedJob { */ private function isCleanUpEnabled() { return (bool)$this->ocConfig->getSystemValue( - 'ldapUserCleanupInterval', strval($this->defaultIntervalMin)); + 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin); } /** @@ -215,7 +215,7 @@ class CleanUp extends TimedJob { * @return int */ private function getOffset() { - return intval($this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0)); + return (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0); } /** diff --git a/apps/user_ldap/lib/Migration/UUIDFixInsert.php b/apps/user_ldap/lib/Migration/UUIDFixInsert.php index 4a1104f2c6f..a99e13f74ce 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixInsert.php +++ b/apps/user_ldap/lib/Migration/UUIDFixInsert.php @@ -90,7 +90,7 @@ class UUIDFixInsert implements IRepairStep { $offset += $batchSize; } catch (\InvalidArgumentException $e) { if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { - $batchSize = intval(floor(count($records) * 0.8)); + $batchSize = (int)floor(count($records) * 0.8); $retry = true; } } diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index b04a321652c..55fc7499beb 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -207,7 +207,7 @@ class Manager { public function isDeletedUser($id) { $isDeleted = $this->ocConfig->getUserValue( $id, 'user_ldap', 'isDeleted', 0); - return intval($isDeleted) === 1; + return (int)$isDeleted === 1; } /** diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php index 942eee84cb7..9576b49d5a2 100644 --- a/apps/user_ldap/lib/User/OfflineUser.php +++ b/apps/user_ldap/lib/User/OfflineUser.php @@ -166,7 +166,7 @@ class OfflineUser { * @return int */ public function getLastLogin() { - return intval($this->lastLogin); + return (int)$this->lastLogin; } /** @@ -211,7 +211,7 @@ class OfflineUser { ', 1); $query->execute(array($this->ocName)); $sResult = $query->fetchColumn(0); - if(intval($sResult) === 1) { + if((int)$sResult === 1) { $this->hasActiveShares = true; return; } @@ -223,7 +223,7 @@ class OfflineUser { ', 1); $query->execute(array($this->ocName)); $sResult = $query->fetchColumn(0); - if(intval($sResult) === 1) { + if((int)$sResult === 1) { $this->hasActiveShares = true; return; } diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index bf7c6bbeb93..433bd2fb73a 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -227,7 +227,7 @@ class Wizard extends LDAPUtility { if ($attr !== '' && $attr !== 'displayName') { // most likely not the default value with upper case N, // verify it still produces a result - $count = intval($this->countUsersWithAttribute($attr, true)); + $count = (int)$this->countUsersWithAttribute($attr, true); if($count > 0) { //no change, but we sent it back to make sure the user interface //is still correct, even if the ajax call was cancelled meanwhile @@ -239,7 +239,7 @@ class Wizard extends LDAPUtility { // first attribute that has at least one result wins $displayNameAttrs = array('displayname', 'cn'); foreach ($displayNameAttrs as $attr) { - $count = intval($this->countUsersWithAttribute($attr, true)); + $count = (int)$this->countUsersWithAttribute($attr, true); if($count > 0) { $this->applyFind('ldap_display_name', $attr); @@ -267,7 +267,7 @@ class Wizard extends LDAPUtility { $attr = $this->configuration->ldapEmailAttribute; if ($attr !== '') { - $count = intval($this->countUsersWithAttribute($attr, true)); + $count = (int)$this->countUsersWithAttribute($attr, true); if($count > 0) { return false; } diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php index 3e4d8b9cba7..d0dfbcada3a 100644 --- a/core/Command/Integrity/CheckApp.php +++ b/core/Command/Integrity/CheckApp.php @@ -63,7 +63,7 @@ class CheckApp extends Base { */ protected function execute(InputInterface $input, OutputInterface $output) { $appid = $input->getArgument('appid'); - $path = strval($input->getOption('path')); + $path = (string)$input->getOption('path'); $result = $this->checker->verifyAppSignature($appid, $path); $this->writeArrayInOutputFormat($input, $output, $result); if (count($result)>0){ diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 4357a2eb437..2b43a27b7ac 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -87,14 +87,14 @@ class Manager implements ICommentsManager { * @return array */ protected function normalizeDatabaseData(array $data) { - $data['id'] = strval($data['id']); - $data['parent_id'] = strval($data['parent_id']); - $data['topmost_parent_id'] = strval($data['topmost_parent_id']); + $data['id'] = (string)$data['id']; + $data['parent_id'] = (string)$data['parent_id']; + $data['topmost_parent_id'] = (string)$data['topmost_parent_id']; $data['creation_timestamp'] = new \DateTime($data['creation_timestamp']); if (!is_null($data['latest_child_timestamp'])) { $data['latest_child_timestamp'] = new \DateTime($data['latest_child_timestamp']); } - $data['children_count'] = intval($data['children_count']); + $data['children_count'] = (int)$data['children_count']; return $data; } @@ -171,7 +171,7 @@ class Manager implements ICommentsManager { $resultStatement = $query->execute(); $data = $resultStatement->fetch(\PDO::FETCH_NUM); $resultStatement->closeCursor(); - $children = intval($data[0]); + $children = (int)$data[0]; $comment = $this->get($id); $comment->setChildrenCount($children); @@ -207,7 +207,7 @@ class Manager implements ICommentsManager { if (empty($id)) { return; } - $this->commentsCache[strval($id)] = $comment; + $this->commentsCache[(string)$id] = $comment; } /** @@ -216,7 +216,7 @@ class Manager implements ICommentsManager { * @param mixed $id the comment's id */ protected function uncache($id) { - $id = strval($id); + $id = (string)$id; if (isset($this->commentsCache[$id])) { unset($this->commentsCache[$id]); } @@ -232,7 +232,7 @@ class Manager implements ICommentsManager { * @since 9.0.0 */ public function get($id) { - if (intval($id) === 0) { + if ((int)$id === 0) { throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); } @@ -402,7 +402,7 @@ class Manager implements ICommentsManager { $resultStatement = $query->execute(); $data = $resultStatement->fetch(\PDO::FETCH_NUM); $resultStatement->closeCursor(); - return intval($data[0]); + return (int)$data[0]; } /** @@ -569,7 +569,7 @@ class Manager implements ICommentsManager { ->execute(); if ($affectedRows > 0) { - $comment->setId(strval($qb->getLastInsertId())); + $comment->setId((string)$qb->getLastInsertId()); $this->sendEvent(CommentsEvent::EVENT_ADD, $comment); } diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index 9f18a6acd6b..ea848f83622 100644 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -50,7 +50,7 @@ class LargeFileHelper { * PHP platform. */ public function __construct() { - $pow_2_53 = floatval(self::POW_2_53_MINUS_1) + 1.0; + $pow_2_53 = (float)self::POW_2_53_MINUS_1 + 1.0; if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) { throw new \RuntimeException( 'This class assumes floats to be double precision or "better".' diff --git a/lib/private/Route/CachingRouter.php b/lib/private/Route/CachingRouter.php index 355f9e80c3f..cb1b98d77e6 100644 --- a/lib/private/Route/CachingRouter.php +++ b/lib/private/Route/CachingRouter.php @@ -52,7 +52,7 @@ class CachingRouter extends Router { */ public function generate($name, $parameters = array(), $absolute = false) { asort($parameters); - $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . intval($absolute); + $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . sha1(json_encode($parameters)) . (int)$absolute; $cachedKey = $this->cache->get($key); if ($cachedKey) { return $cachedKey; diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 9f93ef784bc..65068973e40 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -220,8 +220,8 @@ class JSConfigHelper { 'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null), 'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), - 'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)), - 'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)), + 'sharing.maxAutocompleteResults' => (int)$this->config->getSystemValue('sharing.maxAutocompleteResults', 0), + 'sharing.minSearchStringLength' => (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0), 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, ]), "oc_appconfig" => json_encode([ diff --git a/lib/private/legacy/files.php b/lib/private/legacy/files.php index ba635d57627..24324bca095 100644 --- a/lib/private/legacy/files.php +++ b/lib/private/legacy/files.php @@ -148,7 +148,7 @@ class OC_Files { self::lockFiles($view, $dir, $files); $streamer->sendHeaders($name); - $executionTime = intval(OC::$server->getIniWrapper()->getNumeric('max_execution_time')); + $executionTime = (int)OC::$server->getIniWrapper()->getNumeric('max_execution_time'); if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { @set_time_limit(0); } @@ -344,7 +344,7 @@ class OC_Files { */ public static function setUploadLimit($size, $files = []) { //don't allow user to break his config - $size = intval($size); + $size = (int)$size; if ($size < self::UPLOAD_MIN_LIMIT_BYTES) { return false; } diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index e88e967a57b..cd69b40b76b 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -141,7 +141,7 @@ class OC_Helper { public static function computerFileSize($str) { $str = strtolower($str); if (is_numeric($str)) { - return floatval($str); + return (float)$str; } $bytes_array = array( @@ -158,7 +158,7 @@ class OC_Helper { 'p' => 1024 * 1024 * 1024 * 1024 * 1024, ); - $bytes = floatval($str); + $bytes = (float)$str; if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) { $bytes *= $bytes_array[$matches[1]]; diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index 2cd439e9e6e..290ffe120a3 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -284,7 +284,7 @@ function human_file_size( $bytes ) { function strip_time($timestamp){ $date = new \DateTime("@{$timestamp}"); $date->setTime(0, 0, 0); - return intval($date->format('U')); + return (int)$date->format('U'); } /** diff --git a/lib/public/Collaboration/Collaborators/SearchResultType.php b/lib/public/Collaboration/Collaborators/SearchResultType.php index e4ad888d6e4..e45b26e8dcc 100644 --- a/lib/public/Collaboration/Collaborators/SearchResultType.php +++ b/lib/public/Collaboration/Collaborators/SearchResultType.php @@ -58,7 +58,7 @@ class SearchResultType { * @since 13.0.0 */ protected function getValidatedType($type) { - $type = trim(strval($type)); + $type = trim((string)$type); if($type === '') { throw new \InvalidArgumentException('Type must not be empty'); |