Frytimo pr patches for php8.1 (#6630)

* Passing null to parameter #2 ($string) of type string is deprecated

* Passing null to parameter #1 ($string) of type string is deprecated

* php 8.1 fixes

* php 8.1 fixes - replace strlen($var) > 0 with !empty($var)

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - strlower with null

* php 8.1 fixes - strreplace with null

* php 8.1 fixes - passing null to base64_decode

* php 8.1 fixes - check for false and check for null on $this->dir

* php 8.1 fixes - remove assignment of $db variable to modules object

* php 8.1 fixes - avoid sending null to substr

* php 8.1 fixes - change ${var} to {$var}

* php 8.1 fixes - check for null before preg_replace

* php 8.1 fixes - remove setting db variable on domains object

* php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null

* php 8.1 fixes - set empty string if $_REQUEST['show'] is not available

* php 8.1 fixes

* php 8.1 fixes - correct $_POST checking syntax

* php 8.1 fixes - correct $_POST variables

* php 8.1 fixes

* Use brackets consistently

* Update user_setting_edit.php

* Change to not empty

* Update device.php

* Update text.php

---------

Co-authored-by: Tim Fry <tim@voipstratus.com>
Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
frytimo
2023-05-05 13:46:37 -03:00
committed by GitHub
parent ebbb2f1a72
commit fef8165be2
230 changed files with 1948 additions and 1937 deletions

View File

@@ -18,6 +18,7 @@ class plugin_database {
public $username;
public $password;
public $key;
public $debug;
/**
* database checks the local database to authenticate the user or key
@@ -136,7 +137,7 @@ class plugin_database {
$sql .= "u.user_email, u.salt, u.api_key, u.domain_uuid, d.domain_name ";
$sql .= "from v_users as u, v_domains as d ";
$sql .= "where u.domain_uuid = d.domain_uuid ";
if (strlen($this->key) > 30) {
if (strlen($this->key ?? '') > 30) {
$sql .= "and u.api_key = :api_key ";
$parameters['api_key'] = $this->key;
}
@@ -199,7 +200,7 @@ class plugin_database {
$valid_password = true;
}
else if (substr($row["password"], 0, 1) === '$') {
if (isset($this->password) && strlen($this->password) > 0) {
if (isset($this->password) && !empty($this->password)) {
if (password_verify($this->password, $row["password"])) {
$valid_password = true;
}

View File

@@ -17,6 +17,7 @@ class plugin_email {
public $user_uuid;
public $user_email;
public $contact_uuid;
public $debug;
/**
* time based one time password with email
@@ -119,7 +120,7 @@ class plugin_email {
unset($parameters);
//set class variables
//if (strlen($row["user_email"]) > 0) {
//if (!empty($row["user_email"])) {
// $this->user_uuid = $row['user_uuid'];
// $this->user_email = $row['user_email'];
// $this->contact_uuid = $row['contact_uuid'];
@@ -132,7 +133,7 @@ class plugin_email {
$_SESSION["contact_uuid"] = $row["contact_uuid"];
//user email not found
if (strlen($row["user_email"]) == 0) {
if (empty($row["user_email"])) {
//build the result array
$result["plugin"] = "email";
$result["domain_name"] = $_SESSION["domain_name"];

View File

@@ -116,7 +116,7 @@ class plugin_ldap {
$user_authorized = false;
//provide backwards compatability
if (strlen($_SESSION["ldap"]["user_dn"]["text"]) > 0) {
if (!empty($_SESSION["ldap"]["user_dn"]["text"])) {
$_SESSION["ldap"]["user_dn"][] = $_SESSION["ldap"]["user_dn"]["text"];
}
@@ -127,7 +127,7 @@ class plugin_ldap {
//Note: As of 4/16, the call below will fail randomly. PHP debug reports ldap_bind
//called below with all arguments '*uninitialized*'. However, the debugger
//single-stepping just before the failing call correctly displays all the values.
if (strlen($bind_pw) > 0) {
if (!empty($bind_pw)) {
$bind = ldap_bind($connect, $bind_dn, $bind_pw);
if ($bind) {
//connected and authorized