Skip to content

Commit f805758

Browse files
Merge pull request #346 from W0rma/php81
Fix deprecation warnings in PHP 8.1
2 parents c99b427 + c3a577e commit f805758

File tree

10 files changed

+22
-17
lines changed

10 files changed

+22
-17
lines changed

Protocols/EPP/eppData/eppContact.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function setEmail($email) {
163163

164164
/**
165165
* Gets the email address
166-
* @return string
166+
* @return string|null
167167
*/
168168
public function getEmail() {
169169
return $this->email;
@@ -205,7 +205,7 @@ public function setVoice($voice) {
205205

206206
/**
207207
* Gets the phone number
208-
* @return string
208+
* @return string|null
209209
*/
210210
public function getVoice() {
211211
return $this->voice;

Protocols/EPP/eppData/eppContactPostalInfo.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ class eppContactPostalInfo {
3333
* @param string $type POSTAL_TYPE_LOC or POSTAL_TYPE_INT
3434
*/
3535
public function __construct($name = null, $city = null, $countrycode = null, $organisationName = null, $street = null, $province = null, $zipcode = null, $type = eppContact::TYPE_AUTO) {
36-
$this->setName($name);
36+
if (null !== $name) {
37+
$this->setName($name);
38+
}
3739
#
3840
# Street can be an array of max 3 streets, or a string with an address
3941
#
@@ -190,7 +192,7 @@ public function setProvince($province) {
190192

191193
/**
192194
* Gets the province
193-
* @return string
195+
* @return string|null
194196
*/
195197
public function getProvince() {
196198
return $this->province;

Protocols/EPP/eppData/eppDomain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public function setAuthorisationCode($authorisationCode) {
336336

337337
/**
338338
*
339-
* @return string
339+
* @return string|null
340340
*/
341341
public function getAuthorisationCode() {
342342
return $this->authorisationCode;

Protocols/EPP/eppData/eppHost.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct($hostname, $ipaddress = null, $hoststatus = null) {
5656
}
5757
}
5858
} else {
59-
if (strlen($ipaddress)) {
59+
if (is_string($ipaddress) && strlen($ipaddress)) {
6060
$this->setIpAddress($ipaddress);
6161
}
6262
}
@@ -67,7 +67,7 @@ public function __construct($hostname, $ipaddress = null, $hoststatus = null) {
6767
}
6868
}
6969
} else {
70-
if (strlen($hoststatus)) {
70+
if (is_string($hoststatus) && strlen($hoststatus)) {
7171
$this->setHostStatus($hoststatus);
7272
}
7373
}

Protocols/EPP/eppRequests/eppCreateDomainRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function setDomain(eppDomain $domain) {
122122
}
123123
}
124124
}
125-
if (strlen($domain->getAuthorisationCode())) {
125+
if (is_string($domain->getAuthorisationCode()) && strlen($domain->getAuthorisationCode())) {
126126
$authinfo = $this->createElement('domain:authInfo');
127127
if ($this->useCdata()) {
128128
$pw = $authinfo->appendChild($this->createElement('domain:pw'));

Protocols/EPP/eppRequests/eppTransferRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function setDomainCancel(eppDomain $domain) {
152152
* @param eppDomain $domain
153153
*/
154154
private function addAuthcode($domain) {
155-
if (strlen($domain->getAuthorisationCode())>0) {
155+
if (is_string($domain->getAuthorisationCode()) && strlen($domain->getAuthorisationCode())>0) {
156156
$authinfo = $this->createElement('domain:authInfo');
157157
if ($this->useCdata()) {
158158
$pw = $authinfo->appendChild($this->createElement('domain:pw'));
@@ -190,7 +190,7 @@ public function setDomainRequest(eppDomain $domain) {
190190
$domainperiod->setAttribute('unit', eppDomain::DOMAIN_PERIOD_UNIT_Y);
191191
$this->domainobject->appendChild($domainperiod);
192192
}
193-
if (strlen($domain->getAuthorisationCode())) {
193+
if (is_string($domain->getAuthorisationCode()) && strlen($domain->getAuthorisationCode())) {
194194
$authinfo = $this->createElement('domain:authInfo');
195195
if ($this->useCdata()) {
196196
$pw = $authinfo->appendChild($this->createElement('domain:pw'));

Protocols/EPP/eppRequests/eppUpdateContactRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function addContactChanges($element, eppContact $contact) {
115115
if (strlen($postal->getCity())) {
116116
$postaladdr->appendChild($this->createElement('contact:city', $postal->getCity()));
117117
}
118-
if (strlen($postal->getProvince())) {
118+
if (is_string($postal->getProvince()) && strlen($postal->getProvince())) {
119119
$postaladdr->appendChild($this->createElement('contact:sp', $postal->getProvince()));
120120
}
121121
if (strlen($postal->getZipcode())) {
@@ -129,15 +129,15 @@ private function addContactChanges($element, eppContact $contact) {
129129
$element->appendChild($postalinfo);
130130
}
131131
// Mandatory field
132-
if (strlen($contact->getVoice())) {
132+
if (is_string($contact->getVoice()) && strlen($contact->getVoice())) {
133133
$element->appendChild($this->createElement('contact:voice', $contact->getVoice()));
134134
}
135135
// Optional field, may be empty
136136
if (!is_null($contact->getFax())) {
137137
$element->appendChild($this->createElement('contact:fax', $contact->getFax()));
138138
}
139139
// Mandatory field
140-
if (strlen($contact->getEmail())) {
140+
if (is_string($contact->getEmail()) && strlen($contact->getEmail())) {
141141
$element->appendChild($this->createElement('contact:email', $contact->getEmail()));
142142
}
143143
// Optional field, may be empty

Protocols/EPP/eppRequests/eppUpdateDomainRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,15 @@ protected function addDomainChanges($element, eppDomain $domain) {
9595
$this->addDomainStatus($element, $status);
9696
}
9797
}
98-
if (strlen($domain->getAuthorisationCode())) {
98+
$authcode = $domain->getAuthorisationCode();
99+
if (is_string($authcode) && strlen($authcode)) {
99100
$authinfo = $this->createElement('domain:authInfo');
100101
if ($this->useCdata()) {
101102
$pw = $this->createElement('domain:pw');
102-
$pw->appendChild($this->createCDATASection($domain->getAuthorisationCode()));
103+
$pw->appendChild($this->createCDATASection($authcode));
103104
}
104105
else {
105-
$pw = $this->createElement('domain:pw',$domain->getAuthorisationCode());
106+
$pw = $this->createElement('domain:pw',$authcode);
106107
}
107108
$authinfo->appendChild($pw);
108109
$element->appendChild($authinfo);

Protocols/EPP/eppResponses/eppResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function findNamespace($namespace) {
109109
return false;
110110
}
111111

112+
#[\ReturnTypeWillChange]
112113
public function saveXML(\DOMNode $node = NULL, $options = NULL) {
113114
return str_replace("\t", ' ', parent::saveXML($node, LIBXML_NOEMPTYTAG));
114115
}
@@ -202,7 +203,7 @@ public function Success() {
202203
$errorstring .= '; ' . $id;
203204
}
204205
$resultreason = $this->getResultReason();
205-
if (strlen($resultreason)) {
206+
if (is_string($resultreason) && strlen($resultreason)) {
206207
$errorstring .= ' (' . $resultreason . ')';
207208
}
208209
if ((is_array($this->exceptions)) && (count($this->exceptions)>0)) {

Protocols/TMCH/tmchData/tmchClaimData.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public function __destruct() {
167167
* @param null $options
168168
* @return mixed
169169
*/
170+
#[\ReturnTypeWillChange]
170171
public function saveXML(\DOMNode $node = null, $options = null) {
171172
return str_replace("\t", ' ', parent::saveXML($node, LIBXML_NOEMPTYTAG));
172173
}

0 commit comments

Comments
 (0)