Demonstration of the issue:
$ curl https://apilabs.tyzoid.com/api/hello/test/test++
{
"message_a": "Hello test",
"message_b": "Hello test "
}
Changing
if (preg_match(":^$regex$:", urldecode($this->url), $matches)) {
to
if (preg_match(":^$regex$:", $this->url, $matches)) {
in findUrl() fixes this issue, but investigation is needed to ensure this does not break other intended functionality.