X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Farraywrapper.php;h=30cb6cfdc79da2647580d89aa32d20f6ff8a6c47;hb=8b78e01d4c4b9512a7b74efa52fcaf37de0dc6f1;hp=a8a12b3bb35668ec1bc8e41872e8d5a7ab962b09;hpb=280f8faab4f692ff7f4389f82397adfa6db56325;p=quix0rs-gnu-social.git diff --git a/lib/arraywrapper.php b/lib/arraywrapper.php index a8a12b3bb3..30cb6cfdc7 100644 --- a/lib/arraywrapper.php +++ b/lib/arraywrapper.php @@ -1,7 +1,7 @@ . */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -25,12 +25,14 @@ class ArrayWrapper { var $_items = null; var $_count = 0; + var $N = 0; var $_i = -1; function __construct($items) { $this->_items = $items; $this->_count = count($this->_items); + $this->N = $this->_count; } function fetch() @@ -46,6 +48,16 @@ class ArrayWrapper } } + function fetchAll($k= false, $v = false, $method = false) + { + if ($k !== false || $v !== false || $method !== false) + { + $item =& $this->_items[$this->_i]; + return $item->fetchAll($k, $v, $method); + } + return $this->_items; + } + function __set($name, $value) { $item =& $this->_items[$this->_i]; @@ -74,6 +86,10 @@ class ArrayWrapper function __call($name, $args) { $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); } -} \ No newline at end of file +}