diff options
author | Paweł Sroka <srokap@gmail.com> | 2013-05-27 05:17:08 +0200 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2013-05-27 20:47:55 -0400 |
commit | c7572e614606396617cb1611653f6a759be0a058 (patch) | |
tree | 84bee545e20025cdfb7b6c196cdff318bc3c6ea4 /engine | |
parent | 59df7550f6e1f1dce4f3161682d9fb3000123d40 (diff) | |
download | elgg-c7572e614606396617cb1611653f6a759be0a058.tar.gz elgg-c7572e614606396617cb1611653f6a759be0a058.tar.bz2 |
Refs #5538 - Added regression test
Diffstat (limited to 'engine')
-rw-r--r-- | engine/tests/regression/trac_bugs.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index 7fdd51c27..180fb5112 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -296,4 +296,34 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { $this->assertEqual($output, parse_urls($input)); } } + + /**
+ * Checks if additional select columns does not leak to entity attributes. + *
+ * https://github.com/Elgg/Elgg/issues/5538
+ */
+ public function test_sql_selects_leak_to_attributes() { + global $ENTITY_CACHE; + //may not have groups in DB - let's create one + $group = new ElggGroup(); + $group->name = 'test_group'; + $group->access_id = ACCESS_PUBLIC;
+ $this->assertTrue($group->save() !== false);
+ + //entity cache interferes with our test + $ENTITY_CACHE = array(); + + foreach (array('site', 'user', 'group', 'object') as $type) { + $entities = elgg_get_entities(array( + 'type' => $type,
+ 'selects' => array('42 as added_col'),
+ 'limit' => 1,
+ )); + $entity = array_shift($entities); + $this->assertTrue($entity instanceof ElggEntity); + $this->assertEqual($entity->added_col, null, "Additional select columns are leaking to attributes for " . get_class($entity)); + } + + $group->delete(); + } } |