Fixed readBoolean(), previously readBool()
authorAlexander Ebert <ebert@woltlab.com>
Sun, 13 Jan 2013 16:43:56 +0000 (17:43 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 13 Jan 2013 16:43:56 +0000 (17:43 +0100)
wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php

index 39c246423272df75cac10e0a43ca99ac33ac5dcc..453bc025b1e09cd682bbebc2fdee51fad19d86c2 100644 (file)
@@ -89,7 +89,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
        
        const TYPE_INTEGER = 1;
        const TYPE_STRING = 2;
-       const TYPE_BOOL = 3;
+       const TYPE_BOOLEAN = 3;
        
        /**
         * Initialize a new DatabaseObject-related action.
@@ -404,8 +404,8 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
         * @param       boolean         $allowEmpty
         * @param       string          $arrayIndex
         */
-       protected function readBool($variableName, $allowEmpty = false, $arrayIndex = '') {
-               $this->readValue($variableName, $allowEmpty, $arrayIndex, self::TYPE_BOOL);
+       protected function readBoolean($variableName, $allowEmpty = false, $arrayIndex = '') {
+               $this->readValue($variableName, $allowEmpty, $arrayIndex, self::TYPE_BOOLEAN);
        }
        
        /**
@@ -465,7 +465,7 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
                                }
                        break;
                        
-                       case self::TYPE_BOOL:
+                       case self::TYPE_BOOLEAN:
                                if (!isset($target[$variableName])) {
                                        if ($allowEmpty) {
                                                $target[$variableName] = false;
@@ -475,11 +475,11 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
                                        }
                                }
                                else {
-                                       if (is_string($target[$variableName])) {
-                                               $target[$variableName] = $target[$variableName] != 'false';
+                                       if (is_numeric($target[$variableName])) {
+                                               $target[$variableName] = (bool) $target[$variableName];
                                        }
                                        else {
-                                               $target[$variableName] = (bool) $target[$variableName];
+                                               $target[$variableName] = $target[$variableName] != 'false';
                                        }
                                }
                        break;