mirror of
https://github.com/roundcube/roundcubemail.git
synced 2025-12-27 23:45:58 +00:00
PHP 8.5 compat. fixes
This commit is contained in:
parent
ba60aa8637
commit
060fc95672
@ -54,7 +54,7 @@ class rcmail_action_mail_import extends rcmail_action
|
||||
if (empty($filepath)) {
|
||||
continue;
|
||||
}
|
||||
} elseif (!in_array($mtype_primary, ['text', 'message'])) {
|
||||
} elseif (!in_array($mtype_primary, ['text', 'message']) && $ctype != 'application/mbox') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -283,24 +283,26 @@ function array_keys_recursive($array)
|
||||
return $keys;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get first element from an array
|
||||
*
|
||||
* @param array $array Input array
|
||||
*
|
||||
* @return mixed First element if found, Null otherwise
|
||||
*/
|
||||
function array_first($array)
|
||||
{
|
||||
// @phpstan-ignore-next-line
|
||||
if (is_array($array) && !empty($array)) {
|
||||
reset($array);
|
||||
foreach ($array as $element) {
|
||||
return $element;
|
||||
if (!function_exists('array_first')) {
|
||||
function array_first($array)
|
||||
{
|
||||
// @phpstan-ignore-next-line
|
||||
if (is_array($array) && !empty($array)) {
|
||||
reset($array);
|
||||
foreach ($array as $element) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -165,8 +165,6 @@ class BootstrapTest extends TestCase
|
||||
public function test_array_first()
|
||||
{
|
||||
$this->assertNull(array_first([]));
|
||||
$this->assertNull(array_first(false));
|
||||
$this->assertNull(array_first('test'));
|
||||
$this->assertSame('test', array_first(['test']));
|
||||
|
||||
$input = ['test1', 'test2'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user