Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/Filters/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function initialize(string $uri = null)
$this->filters['after'][$count - 1] !== 'toolbar'
)
{
array_splice($this->filters['after'], array_search('toolbar', $this->filters['after']), 1);
array_splice($this->filters['after'], array_search('toolbar', $this->filters['after'], true), 1);
$this->filters['after'][] = 'toolbar';
}

Expand Down
7 changes: 3 additions & 4 deletions system/Log/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@
*/
class Logger implements LoggerInterface
{

/**
* Used by the logThreshold Config setting to define
* which errors to show.
*
* @var array
* @var array<string, integer>
*/
protected $logLevels = [
'emergency' => 1,
Expand Down Expand Up @@ -160,7 +159,7 @@ public function __construct($config, bool $debug = CI_DEBUG)
$temp = [];
foreach ($this->loggableLevels as $level)
{
$temp[] = array_search((int) $level, $this->logLevels);
$temp[] = array_search((int) $level, $this->logLevels, true);
}

$this->loggableLevels = $temp;
Expand Down Expand Up @@ -331,7 +330,7 @@ public function log($level, $message, array $context = []): bool
{
if (is_numeric($level))
{
$level = array_search((int) $level, $this->logLevels);
$level = array_search((int) $level, $this->logLevels, true);
}

// Is the level a valid level?
Expand Down
2 changes: 1 addition & 1 deletion system/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ protected function checkRoutes(string $uri): bool
// Are we dealing with a locale?
if (strpos($key, '{locale}') !== false)
{
$localeSegment = array_search('{locale}', preg_split('/[\/]*((^[a-zA-Z0-9])|\(([^()]*)\))*[\/]+/m', $key));
$localeSegment = array_search('{locale}', preg_split('/[\/]*((^[a-zA-Z0-9])|\(([^()]*)\))*[\/]+/m', $key), true);

// Replace it with a regex so it
// will actually match.
Expand Down
2 changes: 1 addition & 1 deletion system/Session/Handlers/DatabaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function read($sessionID): string
}
else
{
$result = ($this->platform === 'postgre') ? base64_decode(rtrim($result->data)) : $result->data;
$result = ($this->platform === 'postgre') ? base64_decode(rtrim($result->data), true) : $result->data;
}

$this->fingerprint = md5($result);
Expand Down
2 changes: 1 addition & 1 deletion system/Validation/FormatRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function timezone(string $str = null): bool
*/
public function valid_base64(string $str = null): bool
{
return (base64_encode(base64_decode($str)) === $str);
return (base64_encode(base64_decode($str, true)) === $str);
}

/**
Expand Down
16 changes: 6 additions & 10 deletions utils/Rector/PassStrictParameterToFunctionParameterRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@ final class PassStrictParameterToFunctionParameterRector extends AbstractRector
{
private const FUNCTION_WITH_ARG_POSITION = [
// position start from 0
'in_array' => 2,
'array_search' => 2,
'base64_decode' => 1,
'in_array' => 2,
];

public function getDefinition(): RectorDefinition
{
return new RectorDefinition('Pass strict to function parameter on specific position argument when no value provided', [
new CodeSample(
<<<'CODE_SAMPLE'
in_array('a', $array);
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
in_array('a', $array, true);
CODE_SAMPLE
),
new CodeSample('array_search($value, $array);', 'array_search($value, $array, true);'),
new CodeSample('base64_decode($string);', 'base64_decode($string, true);'),
new CodeSample("in_array('a', \$array);", "in_array('a', \$array, true);"),
]);
}

Expand Down