0

I have 10000 lines of code outlining routes of my API implemented using the Slim Framework. However, I got an error message preg_match(): Compilation failed: two named subpatterns have the same name at offset 89. The problem is, I got the stack trace referring to this statement preg_match('/cost-centers...', '/overview/funds...', NULL) at the Slim Route.php. Now that my URLs are lengthy, I can't pinpoint which of the URLs have the same name.

Is there any way to have a more detailed stack trace instead of displaying these shortened format?

Earl Lapura
  • 165
  • 2
  • 12
  • 1
    I haven't tried it myself, but a [custom error handler](http://docs.slimframework.com/errors/500/) together with https://stackoverflow.com/questions/1949345/how-can-i-get-the-full-string-of-php-s-gettraceasstring should do what you are trying to do. – Martin Sep 08 '15 at 11:45
  • Check this link https://stackoverflow.com/questions/27998644/custom-rest-routes-in-cakephp – Raymart Prado Feb 13 '20 at 00:26
  • check this link https://stackoverflow.com/questions/27998644/custom-rest-routes-in-cakephp – Raymart Prado Feb 13 '20 at 00:27

1 Answers1

1

Thanks to mgansler for this tip.

I just used a custom error handler with PHP Exception::getTrace() function. I also turned the Slim's default debugging off to ensure that the custom error handler is invoked.

Code goes like this:

$app = new \Slim\Slim(array(
    'debug' => false
));
$app->error(function (\Exception $e) use ($app) {
    //enter manipulation of $e->getTrace()
    //or just var_dump($e->getTrace()) but the format would be chaotic
});
Earl Lapura
  • 165
  • 2
  • 12