]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2490: attributes initialize to NULL instead of empty string or 0. Updated...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Nov 2010 10:09:20 +0000 (10:09 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 20 Nov 2010 10:09:20 +0000 (10:09 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7376 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggData.php
engine/classes/ElggEntity.php
engine/classes/ElggExtender.php
engine/classes/ElggGroup.php
engine/classes/ElggObject.php
engine/classes/ElggSite.php
engine/classes/ElggUser.php
engine/tests/objects/entities.php
engine/tests/objects/objects.php
engine/tests/objects/sites.php
engine/tests/objects/users.php

index 96de1bc8fdf359464cd40439b68e1634246c0a4e..a6cf7d21f6b31b344c6f909e63895dafb115b3f4 100644 (file)
@@ -36,7 +36,7 @@ abstract class ElggData implements
                        $this->attributes = array();
                }
 
-               $this->attributes['time_created'] = '';
+               $this->attributes['time_created'] = NULL;
        }
 
        /**
index 0cf3da8fa3c9797915d4412eafd867df96678163..667302c30f1acf13ce516ccb7c65dfbb0bc02e8c 100644 (file)
@@ -84,17 +84,17 @@ abstract class ElggEntity extends ElggData implements
        protected function initializeAttributes() {
                parent::initializeAttributes();
 
-               $this->attributes['guid'] = "";
-               $this->attributes['type'] = "";
-               $this->attributes['subtype'] = "";
+               $this->attributes['guid'] = NULL;
+               $this->attributes['type'] = NULL;
+               $this->attributes['subtype'] = NULL;
 
                $this->attributes['owner_guid'] = get_loggedin_userid();
                $this->attributes['container_guid'] = get_loggedin_userid();
 
-               $this->attributes['site_guid'] = 0;
+               $this->attributes['site_guid'] = NULL;
                $this->attributes['access_id'] = ACCESS_PRIVATE;
-               $this->attributes['time_updated'] = "";
-               $this->attributes['last_action'] = '';
+               $this->attributes['time_updated'] = NULL;
+               $this->attributes['last_action'] = NULL;
                $this->attributes['enabled'] = "yes";
 
                // There now follows a bit of a hack
index 78ccea3950bb9b6342b68b3031f02190b5151872..95a4d3de3c3137a42e74516dd619f7426172650a 100644 (file)
@@ -22,7 +22,7 @@ abstract class ElggExtender extends ElggData
        protected function initializeAttributes() {
                parent::initializeAttributes();
 
-               $this->attributes['type'] = '';
+               $this->attributes['type'] = NULL;
        }
 
        /**
index 71b2a37d42528caa296790b75963e8816888a635..448c1f7a694e1a6176deab78dbfacb134c01283a 100644 (file)
@@ -33,8 +33,8 @@ class ElggGroup extends ElggEntity
                parent::initializeAttributes();
 
                $this->attributes['type'] = "group";
-               $this->attributes['name'] = "";
-               $this->attributes['description'] = "";
+               $this->attributes['name'] = NULL;
+               $this->attributes['description'] = NULL;
                $this->attributes['tables_split'] = 2;
        }
 
index a808f4b9fbf1fa34851f85fbb42a9770f2525572..74c7be248fb67f91526cb3b3b5c351af3fd46ccb 100644 (file)
@@ -40,8 +40,8 @@ class ElggObject extends ElggEntity {
                parent::initializeAttributes();
 
                $this->attributes['type'] = "object";
-               $this->attributes['title'] = "";
-               $this->attributes['description'] = "";
+               $this->attributes['title'] = NULL;
+               $this->attributes['description'] = NULL;
                $this->attributes['tables_split'] = 2;
        }
 
index 70ad395fed018cf56f272bdea60e4160c3bf503a..da239f1be6b63b837e18d50e0565c0dbfd06b934 100644 (file)
@@ -51,9 +51,9 @@ class ElggSite extends ElggEntity {
                parent::initializeAttributes();
 
                $this->attributes['type'] = "site";
-               $this->attributes['name'] = "";
-               $this->attributes['description'] = "";
-               $this->attributes['url'] = "";
+               $this->attributes['name'] = NULL;
+               $this->attributes['description'] = NULL;
+               $this->attributes['url'] = NULL;
                $this->attributes['tables_split'] = 2;
        }
 
index cb2d565fcb4ea4ad3e2089fa6ed7f61b4d2b5bd1..8f30be37e5b05966cabec8caebc8795a62094bd0 100644 (file)
@@ -37,13 +37,13 @@ class ElggUser extends ElggEntity
                parent::initializeAttributes();
 
                $this->attributes['type'] = "user";
-               $this->attributes['name'] = "";
-               $this->attributes['username'] = "";
-               $this->attributes['password'] = "";
-               $this->attributes['salt'] = "";
-               $this->attributes['email'] = "";
-               $this->attributes['language'] = "";
-               $this->attributes['code'] = "";
+               $this->attributes['name'] = NULL;
+               $this->attributes['username'] = NULL;
+               $this->attributes['password'] = NULL;
+               $this->attributes['salt'] = NULL;
+               $this->attributes['email'] = NULL;
+               $this->attributes['language'] = NULL;
+               $this->attributes['code'] = NULL;
                $this->attributes['banned'] = "no";
                $this->attributes['admin'] = 'no';
                $this->attributes['tables_split'] = 2;
index 24c6859b11e24b481e3d7e26e7bc96689a520ee3..97cf44392540b3f492ba6e1eb84b58102cf5fc57 100644 (file)
@@ -26,16 +26,16 @@ class ElggCoreEntityTest extends ElggCoreUnitTest {
         */
        public function testElggEntityAttributes() {
                $test_attributes = array();
-               $test_attributes['guid'] = '';
-               $test_attributes['type'] = '';
-               $test_attributes['subtype'] = '';
+               $test_attributes['guid'] = NULL;
+               $test_attributes['type'] = NULL;
+               $test_attributes['subtype'] = NULL;
                $test_attributes['owner_guid'] = get_loggedin_userid();
                $test_attributes['container_guid'] = get_loggedin_userid();
-               $test_attributes['site_guid'] = 0;
+               $test_attributes['site_guid'] = NULL;
                $test_attributes['access_id'] = ACCESS_PRIVATE;
-               $test_attributes['time_created'] = '';
-               $test_attributes['time_updated'] = '';
-               $test_attributes['last_action'] = '';
+               $test_attributes['time_created'] = NULL;
+               $test_attributes['time_updated'] = NULL;
+               $test_attributes['last_action'] = NULL;
                $test_attributes['enabled'] = 'yes';
                $test_attributes['tables_split'] = 1;
                $test_attributes['tables_loaded'] = 0;
index 479c837666d81c83002a56f67c134ca4659655cf..95f5076955f4a8f9d1ad280a196eee308a7d54e8 100644 (file)
@@ -38,21 +38,21 @@ class ElggCoreObjectTest extends ElggCoreUnitTest {
 
        public function testElggObjectConstructor() {
                $attributes = array();
-               $attributes['guid'] = '';
+               $attributes['guid'] = NULL;
                $attributes['type'] = 'object';
-               $attributes['subtype'] = '';
+               $attributes['subtype'] = NULL;
                $attributes['owner_guid'] = get_loggedin_userid();
                $attributes['container_guid'] = get_loggedin_userid();
-               $attributes['site_guid'] = 0;
+               $attributes['site_guid'] = NULL;
                $attributes['access_id'] = ACCESS_PRIVATE;
-               $attributes['time_created'] = '';
-               $attributes['time_updated'] = '';
-               $attributes['last_action'] = '';
+               $attributes['time_created'] = NULL;
+               $attributes['time_updated'] = NULL;
+               $attributes['last_action'] = NULL;
                $attributes['enabled'] = 'yes';
                $attributes['tables_split'] = 2;
                $attributes['tables_loaded'] = 0;
-               $attributes['title'] = '';
-               $attributes['description'] = '';
+               $attributes['title'] = NULL;
+               $attributes['description'] = NULL;
                ksort($attributes);
 
                $entity_attributes = $this->entity->expose_attributes();
index d8c458bc4f44edebd3a443c080931d4ca0b39981..4d079c30fdba1fc5c779ada4abffddb54f6211f7 100644 (file)
@@ -41,22 +41,22 @@ class ElggCoreSiteTest extends ElggCoreUnitTest {
         */
        public function testElggSiteConstructor() {
                $attributes = array();
-               $attributes['guid'] = '';
+               $attributes['guid'] = NULL;
                $attributes['type'] = 'site';
-               $attributes['subtype'] = '';
+               $attributes['subtype'] = NULL;
                $attributes['owner_guid'] = get_loggedin_userid();
                $attributes['container_guid'] = get_loggedin_userid();
-               $attributes['site_guid'] = 0;
+               $attributes['site_guid'] = NULL;
                $attributes['access_id'] = ACCESS_PRIVATE;
-               $attributes['time_created'] = '';
-               $attributes['time_updated'] = '';
-               $attributes['last_action'] = '';
+               $attributes['time_created'] = NULL;
+               $attributes['time_updated'] = NULL;
+               $attributes['last_action'] = NULL;
                $attributes['enabled'] = 'yes';
                $attributes['tables_split'] = 2;
                $attributes['tables_loaded'] = 0;
-               $attributes['name'] = '';
-               $attributes['description'] = '';
-               $attributes['url'] = '';
+               $attributes['name'] = NULL;
+               $attributes['description'] = NULL;
+               $attributes['url'] = NULL;
                ksort($attributes);
 
                $entity_attributes = $this->site->expose_attributes();
index fe5b48b0373e4736c42441eab6b200f49421515c..c0566c9b4eb32b1477bb2b922085aff8c655bbc5 100644 (file)
@@ -46,26 +46,26 @@ class ElggCoreUserTest extends ElggCoreUnitTest {
         */
        public function testElggUserConstructor() {
                $attributes = array();
-               $attributes['guid'] = '';
+               $attributes['guid'] = NULL;
                $attributes['type'] = 'user';
-               $attributes['subtype'] = '';
+               $attributes['subtype'] = NULL;
                $attributes['owner_guid'] = get_loggedin_userid();
                $attributes['container_guid'] = get_loggedin_userid();
-               $attributes['site_guid'] = 0;
+               $attributes['site_guid'] = NULL;
                $attributes['access_id'] = ACCESS_PRIVATE;
-               $attributes['time_created'] = '';
-               $attributes['time_updated'] = '';
-               $attributes['last_action'] = '';
+               $attributes['time_created'] = NULL;
+               $attributes['time_updated'] = NULL;
+               $attributes['last_action'] = NULL;
                $attributes['enabled'] = 'yes';
                $attributes['tables_split'] = 2;
                $attributes['tables_loaded'] = 0;
-               $attributes['name'] = '';
-               $attributes['username'] = '';
-               $attributes['password'] = '';
-               $attributes['salt'] = '';
-               $attributes['email'] = '';
-               $attributes['language'] = '';
-               $attributes['code'] = '';
+               $attributes['name'] = NULL;
+               $attributes['username'] = NULL;
+               $attributes['password'] = NULL;
+               $attributes['salt'] = NULL;
+               $attributes['email'] = NULL;
+               $attributes['language'] = NULL;
+               $attributes['code'] = NULL;
                $attributes['banned'] = 'no';
                $attributes['admin'] = 'no';
                ksort($attributes);