8000 Merge pull request #179 from jamieburchell/patch-1 · thephpleague/omnipay-sagepay@2925574 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2925574

Browse files
authored
Merge pull request #179 from jamieburchell/patch-1
Fix preg_match search on NULL
2 parents 67226df + cc93276 commit 2925574

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Message/DirectAuthorizeRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function getClientIp()
135135
$ip = parent::getClientIp();
136136

137137
// OmniPay core could do with a helper for this.
138-
if (! preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $ip)) {
138+
if (! is_null($ip) && ! preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $ip)) {
139139
$ip = null;
140140
}
141141

0 commit comments

Comments
 (0)
0