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

View file

@ -122,6 +122,8 @@ class LSrelation extends LSlog_staticLoggerClass {
$this -> getConfig('linkAttribute', false) $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,10 +253,9 @@ class LSsearchEntry extends LSlog_staticLoggerClass {
else else
self :: log_error("__get($key): custom info function is not callable: ".varDump($this->params['customInfos'][$key]['function'])); self :: log_error("__get($key): custom info function is not callable: ".varDump($this->params['customInfos'][$key]['function']));
} }
else { // Unknown key, log warning
self :: log_warning('LSsearchEntry : '.$this -> dn.' => Unknown property '.$key.' !'); self :: log_warning("$this -> __get($key): invalid property requested\n".LSlog :: get_debug_backtrace_context());
return __("Unknown property !"); return __("Unknown property !");
}
} }
/** /**

View file

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