Unverified Commit 6db40c27 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(errors) Avoid errors when using a partial object in error handling

Object might not be finished when the error happens, take extra precautions

issue #6144
Showing with 16 additions and 17 deletions
+16 -17
......@@ -61,8 +61,8 @@ class SimplePluginError extends FusionDirectoryError
{
$array = parent::toArray();
if (isset($this->object)) {
$array['dn'] = $this->object->getBaseObject()->dn;
if (isset($this->object->dn)) {
$array['dn'] = $this->object->dn;
}
if (isset($this->tab)) {
......@@ -80,8 +80,8 @@ class SimplePluginError extends FusionDirectoryError
{
$msg = '';
if (isset($this->object)) {
$msg .= $this->object->getBaseObject()->dn.' > ';
if (isset($this->object->dn)) {
$msg .= $this->object->dn.' > ';
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
......@@ -106,8 +106,8 @@ class SimplePluginError extends FusionDirectoryError
$breadcrumbs = [];
if (isset($this->object)) {
$breadcrumbs[] = htmlescape($this->object->getBaseObject()->dn);
if (isset($this->object->dn)) {
$breadcrumbs[] = htmlescape($this->object->dn);
}
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
......
......@@ -46,11 +46,11 @@ class SimplePluginHookError extends SimplePluginError
{
$html = '';
if (isset($this->object)) {
$html .= htmlescape($this->object->getBaseObject()->dn.' > ');
if (isset($this->object->dn)) {
$html .= htmlescape($this->object->dn.' > ');
}
if (isset($this->tab)) {
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$html .= htmlescape($this->tab->parent->by_name[get_class($this->tab)].' > ');
}
......
......@@ -53,11 +53,11 @@ class SimplePluginLdapError extends SimplePluginError
{
$html = '';
if (isset($this->object)) {
$html .= htmlescape($this->object->getBaseObject()->dn.' > ');
if (isset($this->object->dn)) {
$html .= htmlescape($this->object->dn.' > ');
}
if (isset($this->tab)) {
if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
$html .= htmlescape($this->tab->parent->by_name[get_class($this->tab)].' > ');
}
......
......@@ -73,7 +73,7 @@ class simpleTabs implements FusionDirectoryDialog
);
}
$baseobject = NULL;
$this->baseclass = NULL;
foreach ($data as $tab) {
if (!plugin_available($tab['CLASS'])) {
continue;
......@@ -85,12 +85,11 @@ class simpleTabs implements FusionDirectoryDialog
$this->by_name[$tab['CLASS']] = $tab['NAME'];
$this->plNotify[$tab['CLASS']] = FALSE;
if ($baseobject === NULL) {
$baseobject = new $tab['CLASS']($this->dn, $attrs_object, $this, TRUE);
$this->by_object[$tab['CLASS']] = $baseobject;
if ($this->baseclass === NULL) {
$this->by_object[$tab['CLASS']] = new $tab['CLASS']($this->dn, $attrs_object, $this, TRUE);
$this->baseclass = $tab['CLASS'];
} else {
$this->by_object[$tab['CLASS']] = new $tab['CLASS']($this->dn, $baseobject, $this, FALSE);
$this->by_object[$tab['CLASS']] = new $tab['CLASS']($this->dn, $this->by_object[$this->baseclass], $this, FALSE);
}
$this->by_object[$tab['CLASS']]->set_acl_category($this->acl_category);
......
Supports Markdown
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