]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
naughty extlib fix (PHP7)
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 26 Apr 2016 00:57:14 +0000 (02:57 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 26 Apr 2016 00:57:14 +0000 (02:57 +0200)
The explode function didn't return empty elements (which split did)

plugins/Xmpp/extlib/XMPPHP/Roster.php

index 69457b22a195454a27a093673129c92ebcab7917..500ff6dcc1e606c91a2c2bfe4a10880d67995890 100644 (file)
@@ -118,12 +118,13 @@ class Roster {
         * @param string $status
        */
        public function setPresence($presence, $priority, $show, $status) {
-               list($jid, $resource) = explode("/", $presence);
+               $parts = explode('/', $presence);
+               $jid = $parts[0];
+               $resource = isset($parts[1]) ? $parts[1] : '';  // apparently we can do '' as an associative array index
                if ($show != 'unavailable') {
                        if (!$this->isContact($jid)) {
                                $this->addContact($jid, 'not-in-roster');
                        }
-                       $resource = $resource ? $resource : '';
                        $this->roster_array[$jid]['presence'][$resource] = array('priority' => $priority, 'show' => $show, 'status' => $status);
                } else { //Nuke unavailable resources to save memory
                        unset($this->roster_array[$jid]['resource'][$resource]);