Creation of dynamic property DirectAdminApi::$logger is deprecated.

MEDIA DIRECTORY

New member
This is my error. I do not know how to solve it. Creation of dynamic property DirectAdminApi::$logger is deprecated on line 67 in /home/magazin2/domains/magazinedirectory.net/public_html/components/modules/direct_admin/apis/direct_admin_api.php
 
This is my error. I do not know how to solve it. Creation of dynamic property DirectAdminApi::$logger is deprecated on line 67 in /home/magazin2/domains/magazinedirectory.net/public_html/components/modules/direct_admin/apis/direct_admin_api.php
Can you provide some code so we can look and figure it out?
Basically, off the top of my head, this means that if you attempt to assign a value to a property like DirectAdminApi::$logger that hasn't been defined in the DirectAdminApi class, PHP will issue a deprecation notice. You should explicitly declare the property in your class definition. This will happen if you are running PHP 8.2 or later.
 
The following is my code:

<?php
2

class DefaultBehaviour { }
3

4

#[\AllowDynamicProperties]
5

class ClassAllowsDynamicProperties { }
6

7

$o1 = new DefaultBehaviour();
8

$o2 = new ClassAllowsDynamicProperties();
9

10

$o1->nonExistingProp = true;
11

$o2->nonExistingProp = true;
12

?>
13

use Blesta\Core\Util\Common\Traits\Container;
14

15

/**
16

* Square API.
17

*
18

* @package blesta
19

* @subpackage blesta.components.modules.square
20

* @copyright Copyright (c) 2010, Phillips Data, Inc.
21

* @license http://www.blesta.com/license/ The Blesta License Agreement
22

* @link http://www.blesta.com/ Blesta
23

*/
24

class SquareApi
25

{
26

// Load traits
27

use Container;
28

29

/**
30

* @var string The application ID
31

*/
32

private $application_id;
33

34

/**
35

* @var string The personal access token
36

*/
37

private $access_token;
38

39

/**
40

* @var string The store location ID
41

*/
42

private $location_id;
43

44

/**
45

* Initializes the class.
46

*
47

* @param string $application_id The application ID
48

* @param string $access_token The personal access token
49

* @param string $location_id The store location ID
50

*/
51

public function __construct($application_id, $access_token, $location_id)
52

{
53

$this->application_id = $application_id;
54

$this->access_token = $access_token;
55

$this->location_id = $location_id;
56

57

// Initialize logger
58

$logger = $this->getFromContainer('logger');
59

$this->logger = $logger;
60

}
61

62

/**
63

* Send a request to the Square API.
64

*
65

* @param string $method Specifies the endpoint and method to invoke
66

* @param array $params The parameters to include in the api call
67

* @param string $type The HTTP request type
68

* @return stdClass An object containing the api response
69

*/
70

private function apiRequest($method, array $params = [], $type = 'GET')
71

{
72

// Send request
73

$ch = curl_init();
74

curl_setopt($ch, CURLOPT_TIMEOUT, 20);
75

curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
76

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
77

78

if (Configure::get('Blesta.curl_verify_ssl')) {
79

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
80

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
81

} else {
82

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
83

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
84

}
85

86

// Set authentication details
87

curl_setopt($ch, CURLOPT_HTTPHEADER, [
88

'Content-Type: application/json',
89

'Authorization: Bearer ' . $this->access_token
90

]);
Now I receive a new error code:

Creation of dynamic property DefaultBehaviour::$nonExistingProp is deprecated.​

 
Hello everyone. I fix errors only to get new ones. I am only digging myself into php program holes. I found the default blesta language.php code. I copied it to my own file. I now receive the following error:

Fatal error: Cannot declare class Loader, because the name is already in use in /home/magazin2/domains/magazinedirectory.net/public_html/vendors/minphp/bridge/src/Lib/Language.php on line 7
 

Attachments

  • Screenshot 2025-02-09 at 5.11.58 PM.png
    Screenshot 2025-02-09 at 5.11.58 PM.png
    774.7 KB · Views: 0
Hello everyone. I fix errors only to get new ones. I am only digging myself into php program holes. I found the default blesta language.php code. I copied it to my own file. I now receive the following error:

Fatal error: Cannot declare class Loader, because the name is already in use in /home/magazin2/domains/magazinedirectory.net/public_html/vendors/minphp/bridge/src/Lib/Language.php on line 7
What version of php are you using?
 
Back
Top