Skip to content

Commit

Permalink
Fix warning in config_get_global()
Browse files Browse the repository at this point in the history
When config_eval() references an unknown config option, the code throws
an ERROR_CONFIG_OPT_NOT_FOUND warning.

To avoid this unwanted behavior, we now check that the config option to
replace actually exists before calling config_get()/config_get_global().
If not, the variable will be left as-is in the returned value.

Fixes #26798
  • Loading branch information
dregad committed Mar 28, 2020
1 parent f45ea66 commit 7fffd66
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/config_api.php
Expand Up @@ -633,6 +633,11 @@ function config_eval( $p_value, $p_global = false ) {
foreach( $t_matches as $t_match ) {
list(, $t_match_with_delimiters, $t_config ) = $t_match;

# Make sure the config actually exists before retrieving it
if( !isset( $GLOBALS['g_' . $t_config ] ) ) {
continue;
}

if( $p_global ) {
$t_repl = config_get_global( $t_config );
} else {
Expand Down

0 comments on commit 7fffd66

Please sign in to comment.