Add warning on unknown key requested using __get methods

This commit is contained in:
Benjamin Renard 2020-09-10 10:38:35 +02:00
parent d0d3e944ed
commit be04b6becf
5 changed files with 14 additions and 5 deletions

View file

@ -1841,6 +1841,8 @@ class LSldapObject extends LSlog_staticLoggerClass {
}
return false;
}
// Unknown key, log warning
self :: log_warning("__get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
}

View file

@ -20,12 +20,14 @@
******************************************************************************/
LSsession :: loadLSclass('LSlog_staticLoggerClass');
/**
* Logger class for LSlog
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSlog_logger {
class LSlog_logger extends LSlog_staticLoggerClass {
// Name
private $name;
@ -95,6 +97,8 @@ class LSlog_logger {
case 'level':
return $this -> level;
}
// Unknown key, log warning
self :: log_warning("$this -> __get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
return;
}

View file

@ -122,6 +122,8 @@ class LSrelation extends LSlog_staticLoggerClass {
$this -> getConfig('linkAttribute', false)
);
}
// Unknown key, log warning
self :: log_warning("__get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
}
/**

View file

@ -253,11 +253,10 @@ class LSsearchEntry extends LSlog_staticLoggerClass {
else
self :: log_error("__get($key): custom info function is not callable: ".varDump($this->params['customInfos'][$key]['function']));
}
else {
self :: log_warning('LSsearchEntry : '.$this -> dn.' => Unknown property '.$key.' !');
// Unknown key, log warning
self :: log_warning("$this -> __get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
return __("Unknown property !");
}
}
/**
* Return a configuration parameter (or default value)

View file

@ -65,6 +65,8 @@ class LSurlRequest {
if (array_key_exists($key, $this->url_params)) {
return urldecode($this->url_params[$key]);
}
// Unknown key, log warning
self :: log_warning("__get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
}
/**