mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
add extra validation on config object to prevent save of defective data
This commit is contained in:
parent
49c891985f
commit
e07045d9d1
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user