r67617 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67616‎ | r67617 | r67618 >
Date:12:44, 8 June 2010
Author:demon
Status:ok
Tags:
Comment:
If hasSession() returns false, we should pass this back so we don't try to return an undefined index. Returning an empty array seems sane, but I haven't tested it really
Modified paths:
  • /trunk/extensions/Collection/Collection.session.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.session.php
@@ -109,7 +109,7 @@
110110
111111 static function purge() {
112112 if ( !self::hasSession() ) {
113 - return;
 113+ return false;
114114 }
115115 $coll = $_SESSION['wsCollection'];
116116 $newitems = array();
@@ -136,11 +136,11 @@
137137 }
138138 $coll['items'] = $newitems;
139139 $_SESSION['wsCollection'] = $coll;
 140+ return true;
140141 }
141142
142143 static function getCollection() {
143 - self::purge();
144 - return $_SESSION['wsCollection'];
 144+ return self::purge() ? $_SESSION['wsCollection'] : array();
145145 }
146146
147147 static function setCollection( $collection ) {

Status & tagging log