From aab8ddfd3078506205c6dd6b5cd8531bb5678b1f Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sat, 10 Dec 2022 01:47:50 +1300 Subject: [PATCH] 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 --- inc/CalDAVRequest.php | 25 +++++++++++++++++++++++++ inc/DAVPrincipal.php | 2 ++ inc/DAVResource.php | 12 ++++++++++++ inc/DAVTicket.php | 6 ++++++ inc/HTTPAuthSession.php | 8 ++++++++ inc/PublicSession.php | 8 ++++++++ inc/RRule.php | 3 ++- testing/test-RRULE-v2.php | 3 +++ 8 files changed, 66 insertions(+), 1 deletion(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index ec9ad1f8..1f1aaba3 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -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. */ diff --git a/inc/DAVPrincipal.php b/inc/DAVPrincipal.php index e67ff977..9ead10c0 100644 --- a/inc/DAVPrincipal.php +++ b/inc/DAVPrincipal.php @@ -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 diff --git a/inc/DAVResource.php b/inc/DAVResource.php index c4a919be..b56ef21d 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -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. diff --git a/inc/DAVTicket.php b/inc/DAVTicket.php index f40e65f7..489588a8 100644 --- a/inc/DAVTicket.php +++ b/inc/DAVTicket.php @@ -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 diff --git a/inc/HTTPAuthSession.php b/inc/HTTPAuthSession.php index 99352f74..69795eaf 100644 --- a/inc/HTTPAuthSession.php +++ b/inc/HTTPAuthSession.php @@ -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; /**#@-*/ /** diff --git a/inc/PublicSession.php b/inc/PublicSession.php index 626bcf44..94d48ab6 100644 --- a/inc/PublicSession.php +++ b/inc/PublicSession.php @@ -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; /**#@-*/ /** diff --git a/inc/RRule.php b/inc/RRule.php index 72854d75..a3432a68 100644 --- a/inc/RRule.php +++ b/inc/RRule.php @@ -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(); diff --git a/testing/test-RRULE-v2.php b/testing/test-RRULE-v2.php index 05a5ec76..2a83d889 100755 --- a/testing/test-RRULE-v2.php +++ b/testing/test-RRULE-v2.php @@ -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;