Skip to content
Snippets Groups Projects
Commit a3dabf0a authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

fix loop over config with missing regex section.

parent 5ce8099f
No related branches found
No related tags found
1 merge request!2fix loop over config with missing regex section.
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* 2019-04-25 v1.2 ah use REQUEST_URI (works on Win and Linux) * 2019-04-25 v1.2 ah use REQUEST_URI (works on Win and Linux)
* 2020-05-06 v1.3 ah added aliases for multiple domains with the same config * 2020-05-06 v1.3 ah added aliases for multiple domains with the same config
* 2020-05-06 v1.4 ah rewrite as class * 2020-05-06 v1.4 ah rewrite as class
* 2023-08-28 v1.5 ah fix loop over config with missing regex section.
*/ */
/** /**
...@@ -229,8 +230,8 @@ class redirect { ...@@ -229,8 +230,8 @@ class redirect {
$aRedirect = $this->aConfig['direct'][$this->sRequest]; $aRedirect = $this->aConfig['direct'][$this->sRequest];
} else { } else {
$this->_wd("no direct match ... scanning regex"); $this->_wd("no direct match ... scanning regex");
if(isset($this->aConfig['regex']) && is_array($this->aConfig['regex'])){
foreach (array_keys($this->aConfig['regex']) as $sRegex) { foreach (array_keys($this->aConfig['regex']) as $sRegex) {
$this->_wd("check if regex [$sRegex] matches $this->sRequest"); $this->_wd("check if regex [$sRegex] matches $this->sRequest");
if (preg_match('#' . $sRegex . '#', $this->sRequest)) { if (preg_match('#' . $sRegex . '#', $this->sRequest)) {
$this->_wd("REGEX MATCH! aborting tests"); $this->_wd("REGEX MATCH! aborting tests");
...@@ -239,6 +240,7 @@ class redirect { ...@@ -239,6 +240,7 @@ class redirect {
} }
} }
} }
}
$this->aRedirect=$aRedirect; $this->aRedirect=$aRedirect;
return $aRedirect; return $aRedirect;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment