LSurl::add_handler: fix handling all params in case of multiple patterns

This commit is contained in:
Benjamin Renard 2021-08-18 12:29:50 +02:00
parent 2fa20316bc
commit 2b71bba8db

View file

@ -33,21 +33,20 @@ class LSurl extends LSlog_staticLoggerClass {
/*
* Configured URL patterns :
*
* array (
* '[URL pattern]' => '[handler]',
* [...]
* )
*
* Example :
*
* array (
* '|get/(?P<name>[a-zA-Z0-9]+)$|' => array (
* 'handler' => 'get',
* 'authenticated' => true,
* 'api_mode' => false,
* 'methods' => array('GET'),
* ),
* '|get/all$|' => => array (
* 'handler' => 'get_all',
* 'authenticated' => true,
* 'api_mode' => false,
* 'methods' => array('GET', 'POST'),
* ),
* )
*
@ -72,10 +71,10 @@ class LSurl extends LSlog_staticLoggerClass {
if (is_array($pattern)) {
if (is_null($handler))
foreach($pattern as $p => $h)
self :: add_handler($p, $h, $override, $api_mode, $methods);
self :: add_handler($p, $h, $authenticated, $override, $api_mode, $methods);
else
foreach($pattern as $p)
self :: add_handler($p, $handler, $override, $api_mode, $methods);
self :: add_handler($p, $handler, $authenticated, $override, $api_mode, $methods);
}
else {
if (!isset(self :: $patterns[$pattern])) {