Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117920545
D4004.1775427421.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
8 KB
Referenced Files
None
Subscribers
None
D4004.1775427421.diff
View Options
diff --git a/lib/api/file_create.php b/lib/api/file_create.php
--- a/lib/api/file_create.php
+++ b/lib/api/file_create.php
@@ -41,10 +41,11 @@
}
}
+ $is_file = false;
if (is_resource($this->args['content'])) {
$chunk = stream_get_contents($this->args['content'], 1024000, 0);
}
- else if ($this->args['path']) {
+ else if ($this->args['path'] ?? null) {
$chunk = $this->args['path'];
$is_file = true;
}
@@ -60,8 +61,8 @@
$request = $this instanceof file_api_file_update ? 'file_update' : 'file_create';
$file = array(
'content' => $this->args['content'],
- 'path' => $this->args['path'],
- 'type' => rcube_mime::file_content_type($chunk, $this->args['file'], $ctype, !$is_file),
+ 'path' => $this->args['path'] ?? null,
+ 'type' => rcube_mime::file_content_type($chunk, $this->args['file'] ?? null, $ctype, !$is_file),
);
if (strpos($file['type'], 'empty') !== false && $ctype) {
@@ -80,7 +81,7 @@
$driver->$request($path, $file);
- if (rcube_utils::get_boolean((string) $this->args['info'])) {
+ if (rcube_utils::get_boolean((string) ($this->args['info'] ?? null))) {
return $driver->file_info($path);
}
}
diff --git a/lib/api/file_info.php b/lib/api/file_info.php
--- a/lib/api/file_info.php
+++ b/lib/api/file_info.php
@@ -34,8 +34,8 @@
// check Manticore support. Note: we don't use config->get('fileapi_manticore')
// here as it may be not properly set if backend driver wasn't initialized yet
$capabilities = $this->api->capabilities(false);
- $manticore = $capabilities['MANTICORE'];
- $wopi = $capabilities['WOPI'];
+ $manticore = $capabilities['MANTICORE'] ?? null;
+ $wopi = $capabilities['WOPI'] ?? null;
// support file_info by session ID
if (!isset($this->args['file']) || $this->args['file'] === '') {
diff --git a/lib/api/file_list.php b/lib/api/file_list.php
--- a/lib/api/file_list.php
+++ b/lib/api/file_list.php
@@ -36,7 +36,7 @@
}
$params = array(
- 'reverse' => rcube_utils::get_boolean((string) $this->args['reverse']),
+ 'reverse' => rcube_utils::get_boolean((string) ($this->args['reverse'] ?? "")),
);
if (!empty($this->args['sort'])) {
diff --git a/lib/api/quota.php b/lib/api/quota.php
--- a/lib/api/quota.php
+++ b/lib/api/quota.php
@@ -31,14 +31,14 @@
{
parent::handle();
- list($driver, $path) = $this->api->get_driver($this->args['folder']);
+ list($driver, $path) = $this->api->get_driver($this->args['folder'] ?? null);
$quota = $driver->quota($path);
- if (!$quota['total']) {
+ if (!($quota['total'] ?? false)) {
$quota['percent'] = 0;
}
- else if ($quota['total']) {
+ else if ($quota['total'] ?? false) {
if (!isset($quota['percent'])) {
$quota['percent'] = min(100, round(($quota['used']/max(1, $quota['total']))*100));
}
diff --git a/lib/drivers/kolab/kolab_file_storage.php b/lib/drivers/kolab/kolab_file_storage.php
--- a/lib/drivers/kolab/kolab_file_storage.php
+++ b/lib/drivers/kolab/kolab_file_storage.php
@@ -179,6 +179,7 @@
// parse $host
$a_host = parse_url($host);
+ $port = null;
if ($a_host['host']) {
$host = $a_host['host'];
$ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
@@ -268,7 +269,7 @@
{
$this->rc->plugins->exec_hook('startup');
- if ($_SESSION['user_id'] || $user) {
+ if ($_SESSION['user_id'] ?? false || $user) {
// overwrite config with user preferences
$this->rc->user = $user ? $user : new rcube_user($_SESSION['user_id']);
$this->rc->config->set_user_prefs((array)$this->rc->user->get_prefs());
@@ -652,7 +653,7 @@
return array(
'name' => $file['name'],
- 'size' => (int) $file['size'],
+ 'size' => (int) ($file['size'] ?? null),
'type' => (string) $file['type'],
'mtime' => file_utils::date_format($file['changed'], $this->config['date_format'], $this->config['timezone']),
'ctime' => file_utils::date_format($file['created'], $this->config['date_format'], $this->config['timezone']),
@@ -702,11 +703,11 @@
continue;
}
- $filename = $params['prefix'] . $folder_name . file_storage::SEPARATOR . $file['name'];
+ $filename = ($params['prefix'] ?? null) . $folder_name . file_storage::SEPARATOR . ($file['name'] ?? null);
$result[$filename] = array(
'name' => $file['name'],
- 'size' => (int) $file['size'],
+ 'size' => (int) ($file['size'] ?? null),
'type' => (string) $file['type'],
'mtime' => file_utils::date_format($file['changed'], $this->config['date_format'], $this->config['timezone']),
'ctime' => file_utils::date_format($file['created'], $this->config['date_format'], $this->config['timezone']),
@@ -1003,7 +1004,7 @@
// This could probably be optimized by doing a direct
// IMAP LIST command with prepared second argument, but
// it would make caching not optimal
- if ($params['level'] > 0) {
+ if (($params['level'] ?? 0) > 0) {
$offset = isset($params['path']) && strlen($params['path']) ? strlen($params['path']) + 1 : 0;
foreach ($folders as $idx => $folder) {
if (substr_count($folder, $separator, $offset) >= $params['level']) {
@@ -1592,7 +1593,7 @@
*/
protected function from_file_object($file)
{
- if (isset($file['filename']) && !$file['name']) {
+ if (isset($file['filename']) && !($file['name'] ?? false)) {
$file['name'] = $file['filename'];
}
@@ -1626,7 +1627,7 @@
'path' => $file['path'],
'content' => $file['content'],
'mimetype' => $file['type'],
- 'size' => $file['size'],
+ 'size' => $file['size'] ?? null,
));
unset($file['name']);
diff --git a/lib/file_api.php b/lib/file_api.php
--- a/lib/file_api.php
+++ b/lib/file_api.php
@@ -60,7 +60,7 @@
$this->request = strtolower($_GET['method']);
// Check the session, authenticate the user
- if (!$this->session_validate($this->request == 'authenticate', $_REQUEST['token'])) {
+ if (!$this->session_validate($this->request == 'authenticate', $_REQUEST['token'] ?? null)) {
$this->session->destroy(session_id());
$this->session->regenerate_id(false);
@@ -73,7 +73,7 @@
$_SESSION['env'] = $this->env;
// remember client API version
- if (is_numeric($_GET['version'])) {
+ if (is_numeric($_GET['version'] ?? null)) {
$_SESSION['version'] = $_GET['version'];
}
@@ -124,7 +124,7 @@
// Single-document session?
if (!($this instanceof file_api_wopi)
- && ($doc_id = $_SESSION['document_session'])
+ && ($doc_id = ($_SESSION['document_session'] ?? null))
&& (strpos($this->request, 'document') !== 0 || $doc_id != $_GET['id'])
) {
throw new Exception("Access denied", file_api_core::ERROR_UNAUTHORIZED);
@@ -316,7 +316,7 @@
$request = 'document';
}
- $request = $aliases[$request] ?: $request;
+ $request = $aliases[$request] ?? $request;
require_once __DIR__ . "/api/common.php";
include_once __DIR__ . "/api/$request.php";
diff --git a/lib/file_api_core.php b/lib/file_api_core.php
--- a/lib/file_api_core.php
+++ b/lib/file_api_core.php
@@ -279,12 +279,12 @@
return $caps;
}
- if ($caps['MANTICORE']) {
+ if ($caps['MANTICORE'] ?? false) {
$manticore = new file_manticore($this);
$caps['MANTICORE_EDITABLE'] = $manticore->supported_filetypes(true);
}
- if ($caps['WOPI']) {
+ if ($caps['WOPI'] ?? false) {
$wopi = new file_wopi($this);
$caps['WOPI_EDITABLE'] = $wopi->supported_filetypes(true);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 10:17 PM (37 m, 25 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18834765
Default Alt Text
D4004.1775427421.diff (8 KB)
Attached To
Mode
D4004: PHP 8 fixes
Attached
Detach File
Event Timeline