aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 20:02:50 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 20:02:50 +0000
commitd35c99c3a9c7397b448b29db7407501b4824357e (patch)
tree0410e124bc42f0ca7db9543bb32a514b8f29d03a /engine
parent1a792bebc590cdcfc1b888a33209df92be51400d (diff)
downloadelgg-d35c99c3a9c7397b448b29db7407501b4824357e.tar.gz
elgg-d35c99c3a9c7397b448b29db7407501b4824357e.tar.bz2
Fixed bug when trying to set a plugin's priority to 1 without using "first."
git-svn-id: http://code.elgg.org/elgg/trunk@8048 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/classes/ElggPlugin.php29
1 files changed, 10 insertions, 19 deletions
diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php
index 731875755..c682319e3 100644
--- a/engine/classes/ElggPlugin.php
+++ b/engine/classes/ElggPlugin.php
@@ -181,25 +181,16 @@ class ElggPlugin extends ElggObject {
$old_priority = (int) $this->getPriority();
$max_priority = elgg_get_max_plugin_priority();
- // (int) 0 matches (string) first, so cast to string.
- $priority = (string) $priority;
-
- switch ($priority) {
- case '+1':
- $priority = $old_priority + 1;
- break;
-
- case '-1':
- $priority = $old_priority - 1;
- break;
-
- case 'first':
- $priority = 1;
- break;
-
- case 'last':
- $priority = $max_priority;
- break;
+ // can't use switch here because it's not strict and
+ // php evaluates +1 == 1
+ if ($priority === '+1') {
+ $priority = $old_priority + 1;
+ } elseif ($priority === '-1') {
+ $priority = $old_priority - 1;
+ } elseif ($priority === 'first') {
+ $priority = 1;
+ } elseif ($priority === 'last') {
+ $priority = $max_priority;
}
// should be a number by now