View Revisions: Issue #26798

Summary 0026798: PHP warning in config_get_global
Revision 2020-03-19 12:34 by atrol
Description

In some cases config_get_global gives ERROR_CONFIG_OPT_NOT_FOUND warning

PHP Warning:  100 in .../core/config_api.php on line 192

This is WAD at the moment and happens for any string configuration option where function config_eval is not able to reference a variable.

/**
 * check for recursion in defining configuration variables
 * If there is a %text% in the returned value, re-evaluate the "text" part and replace the string
 *
 * @param string  $p_value  Configuration variable to evaluate.
 * @param boolean $p_global If true, gets %text% as a global configuration, defaults to false.
 * @return string
 */
function config_eval( $p_value, $p_global = false ) {

In typical use cases there is no problem, but the approach itself is not clean and can lead to real life issues, e.g this post in forum

Most of the time there is just the warning without any visible side effect, e.g. set

$g_crypto_master_salt     = '%1%C*&^$#Gand$%^$#%@UOOMm60hvxe8AngM=';

but there are also strange restrictions because of this, e.g. you can't set something like

$g_db_password            = '%1%myPasswordThatCantainsTwoDollars'
Revision 2020-03-19 12:28 by atrol
Description

In some cases config_get_global gives ERROR_CONFIG_OPT_NOT_FOUND warning
PHP Warning: 100 in .../core/config_api.php on line 192

This is WAD at the moment and happens for any string configuration option where function config_eval is not able to reference a variable.

/**
 * check for recursion in defining configuration variables
 * If there is a %text% in the returned value, re-evaluate the "text" part and replace the string
 *
 * @param string  $p_value  Configuration variable to evaluate.
 * @param boolean $p_global If true, gets %text% as a global configuration, defaults to false.
 * @return string
 */
function config_eval( $p_value, $p_global = false ) {

In typical use cases there is no problem, but the approach itself is not clean and can lead to real life issues, e.g
this post in forum

Most of the time there is just the warning without any visible side effect, e.g. set

$g_crypto_master_salt     = '%1%C*&^$#Gand$%^$#%@UOOMm60hvxe8AngM=';

but there are also strange restrictions because of this, e.g. you can't set something like

$g_db_password            = '%1%myPasswordThatCantainsTwoDollars'
Revision 2020-03-19 12:26 by atrol
Description

In some cases config_get_global gives ERROR_CONFIG_OPT_NOT_FOUND warning
PHP Warning: 100 in .../core/config_api.php on line 192

This is WAD at the moment and happens for any string configuration option where function config_eval is not able to reference a variable.

/**
 * check for recursion in defining configuration variables
 * If there is a %text% in the returned value, re-evaluate the "text" part and replace the string
 *
 * @param string  $p_value  Configuration variable to evaluate.
 * @param boolean $p_global If true, gets %text% as a global configuration, defaults to false.
 * @return string
 */
function config_eval( $p_value, $p_global = false ) {

In typical use cases there is no problem, but the approach itself is not clean and can lead to real life issues, e.g
https://www.mantisbt.org/forums/viewtopic.php?f=3&t=26825

Most of the time there is just the warning without any visible side effect, e.g. set

$g_crypto_master_salt     = '%1%C*&^$#Gand$%^$#%@UOOMm60hvxe8AngM=';

but there are also strange restrictions because of this, e.g. you can't set something like

$g_db_password            = '%1%myPasswordThatCantainsTwoDollars'