Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Kasatkin committed Dec 24, 2015
1 parent f82f2b5 commit 55dc3a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/AGI/RequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public static function createRequest($rawRequest)
if (isset(self::$namesMap[$matches['key']])) {
$matches['key'] = self::$namesMap[$matches['key']];
}
if (preg_match('arg_\d', $matches['key'])) {
$request->arguments[] = $matches['value'];
if (preg_match('/arg_\d+/', $matches['key'])) {
$request->arguments[] = trim($matches['value']);
continue;
}
if (!property_exists($request, $matches['key'])) {
throw new RequestParseException('Unknown Request property: ' . $matches['key']);
Expand Down
2 changes: 2 additions & 0 deletions tests/HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class HandlerTest extends PHPUnit_Framework_TestCase
agi_enhanced: 0.0
agi_accountcode:
agi_threadid: 139668957538048
agi_arg_1: test
EOT;
Expand Down Expand Up @@ -68,5 +69,6 @@ public function testParseRequest()
$this->assertAttributeEquals('0.0', 'enhanced', $a->request);
$this->assertAttributeEquals('', 'accountCode', $a->request);
$this->assertAttributeEquals('139668957538048', 'threadId', $a->request);
$this->assertAttributeEquals(['test'], 'arguments', $a->request);
}
}

0 comments on commit 55dc3a5

Please sign in to comment.