Fixes a possible bug in AbstractDatabaseObjectAction::update()
authorMatthias Schmidt <gravatronics@live.com>
Thu, 1 Dec 2011 21:45:25 +0000 (22:45 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 1 Dec 2011 21:45:25 +0000 (22:45 +0100)
This bug currently occurs if you try to edit the profile inline in the profile itself (Error: "Undefined index: data"). The reason for this bug is that the after saving the input data, the "real" user data isn't updated, only their options which is handled by the UserAction separately (UserAction, line 140), so 'data' doesn't always need to exist.

wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php

index 5f66ed84123eca053d284c2c486080210058fbdb..11c551cbb63d426b56bc1cec389be9d552877b09 100644 (file)
@@ -213,7 +213,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction {
                        throw new ValidateActionException('Insufficient permissions');
                }
                
-               // read data
+               // read objects
                if (!count($this->objects)) {
                        $this->readObjects();
                }
@@ -240,7 +240,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction {
                        throw new ValidateActionException('Insufficient permissions');
                }
                
-               // read data
+               // read objects
                if (!count($this->objects)) {
                        $this->readObjects();
                }
@@ -290,8 +290,10 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction {
                        $this->readObjects();
                }
                
-               foreach ($this->objects as $object) {
-                       $object->update($this->parameters['data']);
+               if (isset($this->parameters['data'])) {
+                       foreach ($this->objects as $object) {
+                               $object->update($this->parameters['data']);
+                       }
                }
        }