Skip to content

Commit cc93276

Browse files
Fix preg_match search on NULL
Fixes #177 (comment)
1 parent 67226df commit cc93276

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)