Skip to content

Instantly share code, notes, and snippets.

@dlyamkin
Created November 23, 2023 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlyamkin/8cc482e2a4f2aa35c3b5d66e888c5e8e to your computer and use it in GitHub Desktop.
Save dlyamkin/8cc482e2a4f2aa35c3b5d66e888c5e8e to your computer and use it in GitHub Desktop.
diff --git a/app/functions/fn.control.php b/app/functions/fn.control.php
index bfa70bce7b..1607cad5fe 100644
--- a/app/functions/fn.control.php
+++ b/app/functions/fn.control.php
@@ -1171,7 +1171,7 @@ function fn_get_request_uri($request_uri)
function fn_check_requested_url($area = AREA)
{
if (!defined('API') && $area == 'C' && !empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['SCRIPT_NAME'])) {
- $request_path = rtrim(@parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
+ $request_path = rtrim((string) @parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/');
if ($request_path != $_SERVER['SCRIPT_NAME']) {
$index_script = Registry::get('config.customer_index');
diff --git a/app/functions/fn.users.php b/app/functions/fn.users.php
index 650e1e7b0b..78a1df6871 100644
--- a/app/functions/fn.users.php
+++ b/app/functions/fn.users.php
@@ -227,7 +227,9 @@ function fn_get_user_email($user_id, array $user_info = null)
*/
function fn_get_api_user($email, $api_key, $token = '')
{
- list($email, $api_key, $token) = array_map('trim', [$email, $api_key, $token]);
+ $email = !empty($email) ? trim($email) : '';
+ $api_key = !empty($api_key) ? trim($api_key) : '';
+ $token = !empty($token) ? trim($token) : '';
$user_data = [];
if ($token) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment