Ensure that all fields are defined, not added dynamically.

PHP 8.2 deprecates dynmically adding properties. See:
  https://php.watch/versions/8.2/dynamic-properties-deprecated
This commit is contained in:
Andrew Ruthven 2022-12-10 01:47:50 +13:00 committed by Andrew Ruthven
parent 46feee1ec7
commit aab8ddfd30
8 changed files with 66 additions and 1 deletions

View File

@ -112,6 +112,31 @@ class CalDAVRequest
*/
private $prefer;
/* These fields were being added dynmically. I initially tried making them
* private, but many tests failed in odd ways. Having them public matches
* the existing behaviour.
*/
public $path;
public $content_type;
public $overwrite;
public $collection;
public $user_no;
public $username;
public $by_email;
public $principal_id;
public $permissions;
public $_is_collection;
public $_is_principal;
public $_is_proxy_request;
public $_locks_found;
public $xml_tags;
public $etag_if_match;
public $etag_none_match;
public $proxy_type;
public $if_clause;
public $lock_token;
public $timeout;
/**
* Create a new CalDAVRequest object.
*/

View File

@ -82,6 +82,8 @@ class DAVPrincipal extends Principal
*/
private $unique_tag;
private $user_address_set;
/**
* Constructor
* @param mixed $parameters If null, an empty Principal is created. If it

View File

@ -143,6 +143,18 @@ class DAVResource
*/
private $tickets;
private $collection_type;
private $created;
private $displayname;
private $modified;
private $path_privs;
private $principal_id;
private $resource_id;
private $user_no;
private $access_tickets;
private $parent_container_type;
private $sync_token;
/**
* Constructor
* @param mixed $parameters If null, an empty Resourced is created.

View File

@ -59,6 +59,12 @@ class DAVTicket
*/
private $grantor_collection_privileges;
/* These fields were being added dynmically. Set to private mostly, I had to
* set these as public for tests to pass: expired
*/
public $expired;
private $expires;
/**
* Constructor
* @param string $ticket_id

View File

@ -55,6 +55,14 @@ class HTTPAuthSession {
* @var groups array
*/
public $groups;
/* These fields were being added dynmically. Set to private mostly, I had to
* set these as public for tests to pass: principal
*/
private $dav_name;
private $logged_in;
public $principal;
private $roles;
/**#@-*/
/**

View File

@ -54,6 +54,14 @@ class PublicSession {
* @var groups array
*/
public $groups;
/* These fields were being added dynmically. Set to private mostly, I had to
* set these as public for tests to pass: principal
*/
private $dav_name;
public $principal;
private $roles;
private $logged_in;
/**#@-*/
/**

View File

@ -638,8 +638,9 @@ class RepeatRule {
private $position;
private $finished;
private $current_base;
private $current_set;
private $original_rule;
private $frequency_string;
public function __construct( $basedate, $rrule, $is_date=null, $return_floating_times=false ) {
if ( $return_floating_times ) $basedate->setAsFloat();

View File

@ -36,6 +36,9 @@ class RRuleTest {
var $PHP_time;
var $SQL_time;
private $result_limit;
private $tz;
function __construct( $description, $start, $recur, $result_description = null ) {
$this->description = $description;
$this->dtstart = $start;