Commit e07045d9 authored by Ad Schellevis's avatar Ad Schellevis

add extra validation on config object to prevent save of defective data

parent 49c89198
......@@ -140,6 +140,12 @@ class Config extends Singleton
if ($node == null) {
$this->simplexml = simplexml_load_string('<'.$this->simplexml[0]->getName().'/>');
$node = $this->simplexml ;
// invalidate object on warnings/errors (prevent save from happening)
set_error_handler(
function() {
$this->statusIsValid = false;
}
);
}
foreach ($source as $itemKey => $itemValue) {
......@@ -166,6 +172,11 @@ class Config extends Singleton
$childNode[0] = $itemValue;
}
}
// restore error handling on initial call
if ($node == $this->simplexml) {
restore_error_handler();
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment