Fix warning in subscribers/subscriptions list pages where we attempted to call free() an ArrayWrapper after it was used up, thus trying to forward the call to a nonexistent object.

Removed the free calls (unneeded since destructors now work), and added an error check w/ logging & an exception for future attempts to forward calls to nonexistent object.
This commit is contained in:
Brion Vibber 2011-01-07 15:29:30 -08:00
parent 35507cd039
commit 5616bfb5ff
3 changed files with 4 additions and 4 deletions

View File

@ -100,8 +100,6 @@ class SubscribersAction extends GalleryAction
} }
} }
$subscribers->free();
$this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
$this->page, 'subscribers', $this->page, 'subscribers',
array('nickname' => $this->user->nickname)); array('nickname' => $this->user->nickname));

View File

@ -106,8 +106,6 @@ class SubscriptionsAction extends GalleryAction
} }
} }
$subscriptions->free();
$this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE,
$this->page, 'subscriptions', $this->page, 'subscriptions',
array('nickname' => $this->user->nickname)); array('nickname' => $this->user->nickname));

View File

@ -76,6 +76,10 @@ class ArrayWrapper
function __call($name, $args) function __call($name, $args)
{ {
$item =& $this->_items[$this->_i]; $item =& $this->_items[$this->_i];
if (!is_object($item)) {
common_log(LOG_ERR, "Invalid entry " . var_export($item, true) . " at index $this->_i of $this->N; calling $name()");
throw new ServerException("Internal error: bad entry in array wrapper list.");
}
return call_user_func_array(array($item, $name), $args); return call_user_func_array(array($item, $name), $args);
} }
} }