Skip to content
Snippets Groups Projects

fix loop over config with missing regex section.

Merged Hahn Axel (hahn) requested to merge add-docker into master
@@ -23,6 +23,7 @@
* 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.4 ah rewrite as class
* 2023-08-28 v1.5 ah fix loop over config with missing regex section.
*/
/**
@@ -229,13 +230,14 @@ class redirect {
$aRedirect = $this->aConfig['direct'][$this->sRequest];
} else {
$this->_wd("no direct match ... scanning regex");
foreach (array_keys($this->aConfig['regex']) as $sRegex) {
$this->_wd("check if regex [$sRegex] matches $this->sRequest");
if (preg_match('#' . $sRegex . '#', $this->sRequest)) {
$this->_wd("REGEX MATCH! aborting tests");
$aRedirect = $this->aConfig['regex'][$sRegex];
break;
if(isset($this->aConfig['regex']) && is_array($this->aConfig['regex'])){
foreach (array_keys($this->aConfig['regex']) as $sRegex) {
$this->_wd("check if regex [$sRegex] matches $this->sRequest");
if (preg_match('#' . $sRegex . '#', $this->sRequest)) {
$this->_wd("REGEX MATCH! aborting tests");
$aRedirect = $this->aConfig['regex'][$sRegex];
break;
}
}
}
}
Loading