From 0a78cb463952660f3bb257dd3dd030db725cd4f4 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 7 Sep 2012 21:06:57 +0200 Subject: Fix the test if a subscription already exists FS#2580 This fixes the test for existing subscriptions by not only testing if the subscription for the deepest namespace level is for the current page but by simply testing all levels. Test case is included, it fails without this change. --- inc/subscription.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/subscription.php b/inc/subscription.php index 1bee1152e..029d93e66 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -132,7 +132,7 @@ function subscription_set($user, $page, $style, $data = null, // Delete subscription if one exists and $overwrite is true. If $overwrite // is false, fail. $subs = subscription_find($page, array('user' => $user)); - if (count($subs) > 0 && array_pop(array_keys($subs)) === $page) { + if (count($subs) > 0 && isset($subs[$page])) { if (!$overwrite) { msg(sprintf($lang['subscr_already_subscribed'], $user, prettyprint_id($page)), -1); -- cgit v1.2.3