Merge pull request #8061 from nextcloud/use-typecasting

Use type casting instead of *val() method
This commit is contained in:
Morris Jobke 2018-01-26 12:25:50 +01:00 committed by GitHub
commit 26682b6936
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 62 additions and 62 deletions

View File

@ -36,7 +36,7 @@ $eventDispatcher->addListener(
$eventDispatcher->addListener(\OCP\Comments\CommentsEntityEvent::EVENT_ENTITY, function(\OCP\Comments\CommentsEntityEvent $event) { $eventDispatcher->addListener(\OCP\Comments\CommentsEntityEvent::EVENT_ENTITY, function(\OCP\Comments\CommentsEntityEvent $event) {
$event->addEntityCollection('files', function($name) { $event->addEntityCollection('files', function($name) {
$nodes = \OC::$server->getUserFolder()->getById(intval($name)); $nodes = \OC::$server->getUserFolder()->getById((int)$name);
return !empty($nodes); return !empty($nodes);
}); });
}); });

View File

@ -40,6 +40,6 @@ class LimitFilter implements XmlDeserializable {
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value'); throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
} }
return intval($value); return (int)$value;
} }
} }

View File

@ -40,6 +40,6 @@ class OffsetFilter implements XmlDeserializable {
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value'); throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
} }
return intval($value); return (int)$value;
} }
} }

View File

@ -97,7 +97,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
} }
$propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node) { $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) { $propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node) {
@ -153,9 +153,9 @@ class CommentPropertiesPlugin extends ServerPlugin {
return null; 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);
} }
} }

View File

@ -369,7 +369,7 @@ abstract class Node implements \Sabre\DAV\INode {
throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).'); throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).');
} }
return intval($mtimeFromRequest); return (int)$mtimeFromRequest;
} }
} }

View File

@ -60,7 +60,7 @@ class SystemTagsRelationsCollection extends SimpleCollection {
$userSession, $userSession,
$groupManager, $groupManager,
function($name) { function($name) {
$nodes = \OC::$server->getUserFolder()->getById(intval($name)); $nodes = \OC::$server->getUserFolder()->getById((int)$name);
return !empty($nodes); return !empty($nodes);
} }
), ),

View File

@ -133,7 +133,7 @@ class Parser {
return [ return [
'mtime' => strtotime($data['write_time']), 'mtime' => strtotime($data['write_time']),
'mode' => hexdec(substr($data['attributes'], strpos($data['attributes'], '('), -1)), '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
]; ];
} }

View File

@ -142,13 +142,13 @@ class Expiration {
$this->canPurgeToSaveSpace = true; $this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue === 'auto') { } elseif ($minValue !== 'auto' && $maxValue === 'auto') {
// Keep for X days but delete anytime if space needed // Keep for X days but delete anytime if space needed
$this->minAge = intval($minValue); $this->minAge = (int)$minValue;
$this->maxAge = self::NO_OBLIGATION; $this->maxAge = self::NO_OBLIGATION;
$this->canPurgeToSaveSpace = true; $this->canPurgeToSaveSpace = true;
} elseif ($minValue === 'auto' && $maxValue !== 'auto') { } elseif ($minValue === 'auto' && $maxValue !== 'auto') {
// Delete anytime if space needed, Delete all older than max automatically // Delete anytime if space needed, Delete all older than max automatically
$this->minAge = self::NO_OBLIGATION; $this->minAge = self::NO_OBLIGATION;
$this->maxAge = intval($maxValue); $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = true; $this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue !== 'auto') { } elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
// Delete all older than max OR older than min if space needed // Delete all older than max OR older than min if space needed
@ -158,8 +158,8 @@ class Expiration {
$maxValue = $minValue; $maxValue = $minValue;
} }
$this->minAge = intval($minValue); $this->minAge = (int)$minValue;
$this->maxAge = intval($maxValue); $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = false; $this->canPurgeToSaveSpace = false;
} }
} }

View File

@ -175,13 +175,13 @@ class Expiration {
$this->canPurgeToSaveSpace = true; $this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue === 'auto') { } elseif ($minValue !== 'auto' && $maxValue === 'auto') {
// Keep for X days but delete anytime if space needed // Keep for X days but delete anytime if space needed
$this->minAge = intval($minValue); $this->minAge = (int)$minValue;
$this->maxAge = self::NO_OBLIGATION; $this->maxAge = self::NO_OBLIGATION;
$this->canPurgeToSaveSpace = true; $this->canPurgeToSaveSpace = true;
} elseif ($minValue === 'auto' && $maxValue !== 'auto') { } elseif ($minValue === 'auto' && $maxValue !== 'auto') {
// Delete anytime if space needed, Delete all older than max automatically // Delete anytime if space needed, Delete all older than max automatically
$this->minAge = self::NO_OBLIGATION; $this->minAge = self::NO_OBLIGATION;
$this->maxAge = intval($maxValue); $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = true; $this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue !== 'auto') { } elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
// Delete all older than max OR older than min if space needed // Delete all older than max OR older than min if space needed
@ -191,8 +191,8 @@ class Expiration {
$maxValue = $minValue; $maxValue = $minValue;
} }
$this->minAge = intval($minValue); $this->minAge = (int)$minValue;
$this->maxAge = intval($maxValue); $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = false; $this->canPurgeToSaveSpace = false;
} }
} }

View File

@ -503,7 +503,7 @@ class Storage {
$toDelete = []; $toDelete = [];
foreach (array_reverse($versions['all']) as $key => $version) { foreach (array_reverse($versions['all']) as $key => $version) {
if (intval($version['version'])<$threshold) { if ((int)$version['version'] <$threshold) {
$toDelete[$key] = $version; $toDelete[$key] = $version;
} else { } else {
//Versions are sorted by time - nothing mo to iterate. //Versions are sorted by time - nothing mo to iterate.

View File

@ -32,7 +32,7 @@ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$serverConnections = $helper->getServerConfigurationPrefixes(); $serverConnections = $helper->getServerConfigurationPrefixes();
sort($serverConnections); sort($serverConnections);
$lk = array_pop($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); $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
$resultData = array('configPrefix' => $nk); $resultData = array('configPrefix' => $nk);

View File

@ -109,8 +109,8 @@ class Search extends Command {
$configPrefixes = $helper->getServerConfigurationPrefixes(true); $configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new LDAP(); $ldapWrapper = new LDAP();
$offset = intval($input->getOption('offset')); $offset = (int)$input->getOption('offset');
$limit = intval($input->getOption('limit')); $limit = (int)$input->getOption('limit');
$this->validateOffsetAndLimit($offset, $limit); $this->validateOffsetAndLimit($offset, $limit);
if($input->getOption('group')) { if($input->getOption('group')) {

View File

@ -106,7 +106,7 @@ class Connection extends LDAPUtility {
$this->doNotValidate = !in_array($this->configPrefix, $this->doNotValidate = !in_array($this->configPrefix,
$helper->getServerConfigurationPrefixes()); $helper->getServerConfigurationPrefixes());
$this->hasPagedResultSupport = $this->hasPagedResultSupport =
intval($this->configuration->ldapPagingSize) !== 0 (int)$this->configuration->ldapPagingSize !== 0
|| $this->ldap->hasPagedResultSupport(); || $this->ldap->hasPagedResultSupport();
} }
@ -368,7 +368,7 @@ class Connection extends LDAPUtility {
} }
} }
$backupPort = intval($this->configuration->ldapBackupPort); $backupPort = (int)$this->configuration->ldapBackupPort;
if ($backupPort <= 0) { if ($backupPort <= 0) {
$this->configuration->backupPort = $this->configuration->ldapPort; $this->configuration->backupPort = $this->configuration->ldapPort;
} }
@ -399,7 +399,7 @@ class Connection extends LDAPUtility {
private function doCriticalValidation() { private function doCriticalValidation() {
$configurationOK = true; $configurationOK = true;
$errorStr = 'Configuration Error (prefix '. $errorStr = 'Configuration Error (prefix '.
strval($this->configPrefix).'): '; (string)$this->configPrefix .'): ';
//options that shall not be empty //options that shall not be empty
$options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName', $options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName',

View File

@ -285,7 +285,7 @@ class ConfigAPIController extends OCSController {
$config = new Configuration($configID); $config = new Configuration($configID);
$data = $config->getConfiguration(); $data = $config->getConfiguration();
if(!boolval(intval($showPassword))) { if(!(int)$showPassword) {
$data['ldapAgentPassword'] = '***'; $data['ldapAgentPassword'] = '***';
} }
foreach ($data as $key => $value) { foreach ($data as $key => $value) {

View File

@ -266,7 +266,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$groups = $this->access->groupsMatchFilter($groups); $groups = $this->access->groupsMatchFilter($groups);
$allGroups = $groups; $allGroups = $groups;
$nestedGroups = $this->access->connection->ldapNestedGroups; $nestedGroups = $this->access->connection->ldapNestedGroups;
if (intval($nestedGroups) === 1) { if ((int)$nestedGroups === 1) {
foreach ($groups as $group) { foreach ($groups as $group) {
$subGroups = $this->_getGroupDNsFromMemberOf($group, $seen); $subGroups = $this->_getGroupDNsFromMemberOf($group, $seen);
$allGroups = array_merge($allGroups, $subGroups); $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 // if possible, read out membership via memberOf. It's far faster than
// performing a search, which still is a fallback later. // performing a search, which still is a fallback later.
// memberof doesn't support memberuid, so skip it here. // memberof doesn't support memberuid, so skip it here.
if(intval($this->access->connection->hasMemberOfFilterSupport) === 1 if((int)$this->access->connection->hasMemberOfFilterSupport === 1
&& intval($this->access->connection->useMemberOfToDetectMembership) === 1 && (int)$this->access->connection->useMemberOfToDetectMembership === 1
&& strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid' && strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid'
) { ) {
$groupDNs = $this->_getGroupDNsFromMemberOf($userDN); $groupDNs = $this->_getGroupDNsFromMemberOf($userDN);

View File

@ -122,7 +122,7 @@ class Helper {
sort($serverConnections); sort($serverConnections);
$lastKey = array_pop($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); return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
} }

View File

@ -69,8 +69,8 @@ class CleanUp extends TimedJob {
public function __construct() { public function __construct() {
$minutes = \OC::$server->getConfig()->getSystemValue( $minutes = \OC::$server->getConfig()->getSystemValue(
'ldapUserCleanupInterval', strval($this->defaultIntervalMin)); 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
$this->setInterval(intval($minutes) * 60); $this->setInterval((int)$minutes * 60);
} }
/** /**
@ -183,7 +183,7 @@ class CleanUp extends TimedJob {
*/ */
private function isCleanUpEnabled() { private function isCleanUpEnabled() {
return (bool)$this->ocConfig->getSystemValue( return (bool)$this->ocConfig->getSystemValue(
'ldapUserCleanupInterval', strval($this->defaultIntervalMin)); 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
} }
/** /**
@ -215,7 +215,7 @@ class CleanUp extends TimedJob {
* @return int * @return int
*/ */
private function getOffset() { private function getOffset() {
return intval($this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0)); return (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0);
} }
/** /**

View File

@ -90,7 +90,7 @@ class UUIDFixInsert implements IRepairStep {
$offset += $batchSize; $offset += $batchSize;
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { 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; $retry = true;
} }
} }

View File

@ -207,7 +207,7 @@ class Manager {
public function isDeletedUser($id) { public function isDeletedUser($id) {
$isDeleted = $this->ocConfig->getUserValue( $isDeleted = $this->ocConfig->getUserValue(
$id, 'user_ldap', 'isDeleted', 0); $id, 'user_ldap', 'isDeleted', 0);
return intval($isDeleted) === 1; return (int)$isDeleted === 1;
} }
/** /**

View File

@ -166,7 +166,7 @@ class OfflineUser {
* @return int * @return int
*/ */
public function getLastLogin() { public function getLastLogin() {
return intval($this->lastLogin); return (int)$this->lastLogin;
} }
/** /**
@ -211,7 +211,7 @@ class OfflineUser {
', 1); ', 1);
$query->execute(array($this->ocName)); $query->execute(array($this->ocName));
$sResult = $query->fetchColumn(0); $sResult = $query->fetchColumn(0);
if(intval($sResult) === 1) { if((int)$sResult === 1) {
$this->hasActiveShares = true; $this->hasActiveShares = true;
return; return;
} }
@ -223,7 +223,7 @@ class OfflineUser {
', 1); ', 1);
$query->execute(array($this->ocName)); $query->execute(array($this->ocName));
$sResult = $query->fetchColumn(0); $sResult = $query->fetchColumn(0);
if(intval($sResult) === 1) { if((int)$sResult === 1) {
$this->hasActiveShares = true; $this->hasActiveShares = true;
return; return;
} }

View File

@ -227,7 +227,7 @@ class Wizard extends LDAPUtility {
if ($attr !== '' && $attr !== 'displayName') { if ($attr !== '' && $attr !== 'displayName') {
// most likely not the default value with upper case N, // most likely not the default value with upper case N,
// verify it still produces a result // verify it still produces a result
$count = intval($this->countUsersWithAttribute($attr, true)); $count = (int)$this->countUsersWithAttribute($attr, true);
if($count > 0) { if($count > 0) {
//no change, but we sent it back to make sure the user interface //no change, but we sent it back to make sure the user interface
//is still correct, even if the ajax call was cancelled meanwhile //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 // first attribute that has at least one result wins
$displayNameAttrs = array('displayname', 'cn'); $displayNameAttrs = array('displayname', 'cn');
foreach ($displayNameAttrs as $attr) { foreach ($displayNameAttrs as $attr) {
$count = intval($this->countUsersWithAttribute($attr, true)); $count = (int)$this->countUsersWithAttribute($attr, true);
if($count > 0) { if($count > 0) {
$this->applyFind('ldap_display_name', $attr); $this->applyFind('ldap_display_name', $attr);
@ -267,7 +267,7 @@ class Wizard extends LDAPUtility {
$attr = $this->configuration->ldapEmailAttribute; $attr = $this->configuration->ldapEmailAttribute;
if ($attr !== '') { if ($attr !== '') {
$count = intval($this->countUsersWithAttribute($attr, true)); $count = (int)$this->countUsersWithAttribute($attr, true);
if($count > 0) { if($count > 0) {
return false; return false;
} }

View File

@ -63,7 +63,7 @@ class CheckApp extends Base {
*/ */
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output) {
$appid = $input->getArgument('appid'); $appid = $input->getArgument('appid');
$path = strval($input->getOption('path')); $path = (string)$input->getOption('path');
$result = $this->checker->verifyAppSignature($appid, $path); $result = $this->checker->verifyAppSignature($appid, $path);
$this->writeArrayInOutputFormat($input, $output, $result); $this->writeArrayInOutputFormat($input, $output, $result);
if (count($result)>0){ if (count($result)>0){

View File

@ -87,14 +87,14 @@ class Manager implements ICommentsManager {
* @return array * @return array
*/ */
protected function normalizeDatabaseData(array $data) { protected function normalizeDatabaseData(array $data) {
$data['id'] = strval($data['id']); $data['id'] = (string)$data['id'];
$data['parent_id'] = strval($data['parent_id']); $data['parent_id'] = (string)$data['parent_id'];
$data['topmost_parent_id'] = strval($data['topmost_parent_id']); $data['topmost_parent_id'] = (string)$data['topmost_parent_id'];
$data['creation_timestamp'] = new \DateTime($data['creation_timestamp']); $data['creation_timestamp'] = new \DateTime($data['creation_timestamp']);
if (!is_null($data['latest_child_timestamp'])) { if (!is_null($data['latest_child_timestamp'])) {
$data['latest_child_timestamp'] = new \DateTime($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; return $data;
} }
@ -171,7 +171,7 @@ class Manager implements ICommentsManager {
$resultStatement = $query->execute(); $resultStatement = $query->execute();
$data = $resultStatement->fetch(\PDO::FETCH_NUM); $data = $resultStatement->fetch(\PDO::FETCH_NUM);
$resultStatement->closeCursor(); $resultStatement->closeCursor();
$children = intval($data[0]); $children = (int)$data[0];
$comment = $this->get($id); $comment = $this->get($id);
$comment->setChildrenCount($children); $comment->setChildrenCount($children);
@ -207,7 +207,7 @@ class Manager implements ICommentsManager {
if (empty($id)) { if (empty($id)) {
return; 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 * @param mixed $id the comment's id
*/ */
protected function uncache($id) { protected function uncache($id) {
$id = strval($id); $id = (string)$id;
if (isset($this->commentsCache[$id])) { if (isset($this->commentsCache[$id])) {
unset($this->commentsCache[$id]); unset($this->commentsCache[$id]);
} }
@ -232,7 +232,7 @@ class Manager implements ICommentsManager {
* @since 9.0.0 * @since 9.0.0
*/ */
public function get($id) { 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.'); throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.');
} }
@ -402,7 +402,7 @@ class Manager implements ICommentsManager {
$resultStatement = $query->execute(); $resultStatement = $query->execute();
$data = $resultStatement->fetch(\PDO::FETCH_NUM); $data = $resultStatement->fetch(\PDO::FETCH_NUM);
$resultStatement->closeCursor(); $resultStatement->closeCursor();
return intval($data[0]); return (int)$data[0];
} }
/** /**
@ -569,7 +569,7 @@ class Manager implements ICommentsManager {
->execute(); ->execute();
if ($affectedRows > 0) { if ($affectedRows > 0) {
$comment->setId(strval($qb->getLastInsertId())); $comment->setId((string)$qb->getLastInsertId());
$this->sendEvent(CommentsEvent::EVENT_ADD, $comment); $this->sendEvent(CommentsEvent::EVENT_ADD, $comment);
} }

View File

@ -50,7 +50,7 @@ class LargeFileHelper {
* PHP platform. * PHP platform.
*/ */
public function __construct() { 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) { if ($this->formatUnsignedInteger($pow_2_53) !== self::POW_2_53) {
throw new \RuntimeException( throw new \RuntimeException(
'This class assumes floats to be double precision or "better".' 'This class assumes floats to be double precision or "better".'

View File

@ -52,7 +52,7 @@ class CachingRouter extends Router {
*/ */
public function generate($name, $parameters = array(), $absolute = false) { public function generate($name, $parameters = array(), $absolute = false) {
asort($parameters); 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); $cachedKey = $this->cache->get($key);
if ($cachedKey) { if ($cachedKey) {
return $cachedKey; return $cachedKey;

View File

@ -220,8 +220,8 @@ class JSConfigHelper {
'enable_avatars' => true, // here for legacy reasons - to not crash existing code that relies on this value '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), 'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null),
'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'), 'modRewriteWorking' => ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
'sharing.maxAutocompleteResults' => intval($this->config->getSystemValue('sharing.maxAutocompleteResults', 0)), 'sharing.maxAutocompleteResults' => (int)$this->config->getSystemValue('sharing.maxAutocompleteResults', 0),
'sharing.minSearchStringLength' => intval($this->config->getSystemValue('sharing.minSearchStringLength', 0)), 'sharing.minSearchStringLength' => (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0),
'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX, 'blacklist_files_regex' => \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX,
]), ]),
"oc_appconfig" => json_encode([ "oc_appconfig" => json_encode([

View File

@ -148,7 +148,7 @@ class OC_Files {
self::lockFiles($view, $dir, $files); self::lockFiles($view, $dir, $files);
$streamer->sendHeaders($name); $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) { if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
@set_time_limit(0); @set_time_limit(0);
} }
@ -344,7 +344,7 @@ class OC_Files {
*/ */
public static function setUploadLimit($size, $files = []) { public static function setUploadLimit($size, $files = []) {
//don't allow user to break his config //don't allow user to break his config
$size = intval($size); $size = (int)$size;
if ($size < self::UPLOAD_MIN_LIMIT_BYTES) { if ($size < self::UPLOAD_MIN_LIMIT_BYTES) {
return false; return false;
} }

View File

@ -141,7 +141,7 @@ class OC_Helper {
public static function computerFileSize($str) { public static function computerFileSize($str) {
$str = strtolower($str); $str = strtolower($str);
if (is_numeric($str)) { if (is_numeric($str)) {
return floatval($str); return (float)$str;
} }
$bytes_array = array( $bytes_array = array(
@ -158,7 +158,7 @@ class OC_Helper {
'p' => 1024 * 1024 * 1024 * 1024 * 1024, '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]])) { if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) {
$bytes *= $bytes_array[$matches[1]]; $bytes *= $bytes_array[$matches[1]];

View File

@ -284,7 +284,7 @@ function human_file_size( $bytes ) {
function strip_time($timestamp){ function strip_time($timestamp){
$date = new \DateTime("@{$timestamp}"); $date = new \DateTime("@{$timestamp}");
$date->setTime(0, 0, 0); $date->setTime(0, 0, 0);
return intval($date->format('U')); return (int)$date->format('U');
} }
/** /**

View File

@ -58,7 +58,7 @@ class SearchResultType {
* @since 13.0.0 * @since 13.0.0
*/ */
protected function getValidatedType($type) { protected function getValidatedType($type) {
$type = trim(strval($type)); $type = trim((string)$type);
if($type === '') { if($type === '') {
throw new \InvalidArgumentException('Type must not be empty'); throw new \InvalidArgumentException('Type must not be empty');