Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
fix(responsetranslator): fixed preg_quote usage, added delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed May 21, 2021
1 parent c513fe6 commit 8988cdd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ResponseTranslator.php
Expand Up @@ -69,7 +69,7 @@ public static function translate($raw, $cmd, $ph = [])
// match the response for given description
// NOTE: we match if the description starts with the given description
// it would also match if it is followed by additional text
$qregex = "/description=" . preg_quote($regex) . "/i";
$qregex = "/description=" . preg_quote($regex, "/") . "([^\r]+)?/i";
if (preg_match($qregex, $newraw)) {
// replace command place holder with API command name used
if (isset($cmd["COMMAND"])) {
Expand Down
2 changes: 1 addition & 1 deletion tests/ResponseTranslatorTest.php
Expand Up @@ -137,7 +137,7 @@ public function testCheckDomainTransferTranslation(): void
// mixed status `locked` and Wrong Auth
$r = new R("[RESPONSE]\r\ncode=219\r\ndescription=Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (clientTransferProhibited)/WRONG AUTH\r\nEOF\r\n", $cmd);
$this->assertEquals(219, $r->getCode());
$this->assertEquals("This Domain is locked. Initiating a Transfer is therefore impossible.", $r->getDescription());
$this->assertEquals("This Domain is locked and the given Authorization Code is wrong. Initiating a Transfer is therefore impossible.", $r->getDescription());

// Age of the Domain <= 60d
$r = new R("[RESPONSE]\r\ncode=219\r\ndescription=Request is not available; DOMAIN TRANSFER IS PROHIBITED BY AGE OF THE DOMAIN\r\nEOF\r\n", $cmd);
Expand Down

0 comments on commit 8988cdd

Please sign in to comment.