Skip to content
Snippets Groups Projects
Commit 509b6a02 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Benni Mack
Browse files

[TASK] Fix phpstan checkFunctionArgumentTypes errors in ext:core Service

This patch fixes incompatible type usage in function arguments
and is preparatory work for introducing native type hints and
strict mode in all core files.

Releases: master, 10.4
Resolves: #92259
Change-Id: I55ca9df860afeb95571e6372a006799c29817576
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65675


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 3feb381a
No related merge requests found
......@@ -329,7 +329,7 @@ abstract class AbstractService implements LoggerAwareInterface
*
* @param string $absFile File name to read from.
* @param int $length Maximum length to read. If empty the whole file will be read.
* @return string|bool $content or FALSE
* @return string|bool file content or false
*/
public function readFile($absFile, $length = 0)
{
......@@ -354,8 +354,12 @@ abstract class AbstractService implements LoggerAwareInterface
{
if (!$absFile) {
$absFile = $this->tempFile($this->prefixId);
if ($absFile === false) {
return false;
}
$absFile = (string)$absFile;
}
if ($absFile && GeneralUtility::isAllowedAbsPath($absFile)) {
if (GeneralUtility::isAllowedAbsPath($absFile)) {
if ($fd = @fopen($absFile, 'wb')) {
@fwrite($fd, $content);
@fclose($fd);
......@@ -446,7 +450,7 @@ abstract class AbstractService implements LoggerAwareInterface
* Get the input content.
* Will be read from input file if needed. (That is if ->inputContent is empty and ->inputFile is not)
*
* @return mixed
* @return string|bool
*/
public function getInput()
{
......@@ -481,7 +485,7 @@ abstract class AbstractService implements LoggerAwareInterface
/**
* Set the output file name.
*
* @param string $absFile File name
* @param string|bool $absFile File name
*/
public function setOutputFile($absFile)
{
......@@ -491,7 +495,7 @@ abstract class AbstractService implements LoggerAwareInterface
/**
* Get the output content.
*
* @return mixed
* @return string
*/
public function getOutput()
{
......
......@@ -73,7 +73,7 @@ class ZipService
}
for ($i = 0; $i < $zip->numFiles; $i++) {
$entryName = $zip->getNameIndex($i);
$entryName = (string)$zip->getNameIndex($i);
if (preg_match('#/(?:\.{2,})+#', $entryName) // Contains any traversal sequence starting with a slash, e.g. /../, /.., /.../
|| preg_match('#^(?:\.{2,})+/#', $entryName) // Starts with a traversal sequence, e.g. ../, .../
) {
......
......@@ -74,7 +74,7 @@ class OpcodeCacheService
*/
protected static function isClearable(): bool
{
$disabled = explode(',', ini_get('disable_functions'));
$disabled = explode(',', (string)ini_get('disable_functions'));
return !(in_array('opcache_invalidate', $disabled, true) || in_array('opcache_reset', $disabled, true));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment