Skip to content

Commit 27a0fd5

Browse files
Merge branch '5.4' into 6.0
* 5.4: Leverage str_contains/str_starts_with Leverage str_ends_with
2 parents 4652163 + ff62d28 commit 27a0fd5

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Crypto/SMime.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function getMessageHeaders(string $headerData): array
8383
}
8484

8585
// Handle headers that span multiple lines
86-
if (false === strpos($headerLine, ':')) {
86+
if (!str_contains($headerLine, ':')) {
8787
$headers[$currentHeaderName] .= ' '.trim($headerLine);
8888
continue;
8989
}

FileBinaryMimeTypeGuesser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function guessMimeType(string $path): ?string
7474
ob_start();
7575

7676
// need to use --mime instead of -i. see #6641
77-
passthru(sprintf($this->cmd, escapeshellarg((0 === strpos($path, '-') ? './' : '').$path)), $return);
77+
passthru(sprintf($this->cmd, escapeshellarg((str_starts_with($path, '-') ? './' : '').$path)), $return);
7878
if ($return > 0) {
7979
ob_end_clean();
8080

Tests/AbstractMimeTypeGuesserTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function testGuessWithNonReadablePath()
116116
touch($path);
117117
@chmod($path, 0333);
118118

119-
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
119+
if (str_ends_with(sprintf('%o', fileperms($path)), '0333')) {
120120
$this->expectException(\InvalidArgumentException::class);
121121
$this->getGuesser()->guessMimeType($path);
122122
} else {

Tests/Crypto/SMimeSignerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private function assertMessageSignatureIsValid(Message $message, Message $origin
159159
$this->assertMessageHeaders($message, $originalMessage);
160160
$this->assertTrue(openssl_pkcs7_verify($messageFile, 0, $this->generateTmpFilename(), [$this->samplesDir.'ca.crt']), sprintf('Verification of the message %s failed. Internal error "%s".', $messageFile, openssl_error_string()));
161161

162-
if (false === strpos($messageString, 'enveloped-data')) {
162+
if (!str_contains($messageString, 'enveloped-data')) {
163163
// Tamper to ensure it actually verified
164164
file_put_contents($messageFile, str_replace('Content-Transfer-Encoding: ', 'Content-Transfer-Encoding: ', $messageString));
165165
$this->assertFalse(openssl_pkcs7_verify($messageFile, 0, $this->generateTmpFilename(), [$this->samplesDir.'ca.crt']), sprintf('Verification of the message failed. Internal error "%s".', openssl_error_string()));

0 commit comments

Comments
 (0)