Fix PHP incompatibilities in XMPPHP

This fixes the following to errors in XMPPHP:

Stack trace:
0 [internal function]: XMPPHP_XMLStream->endXML(Resource id 150, 'STREAM:FEATURES')
1 /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php(420): xml_parse(Resource id 150, '<?xml version='...', false)
2 /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php(471): XMPPHP_XMLStream->__process()
3 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(165): XMPPHP_XMLStream->processUntil(Array)
4 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(49): XmppManager->connect()
5 /var/vhosts/example.org/lib/iomaster.php(248): XmppManager->start(Object(ImMaster))
6 /var/vhosts/example.org/lib/iomaster.php(111): IoMaster->start()
7 /var/vhosts/example.org/scripts/imdaemon.php(58): IoMaster->service()
8 /var/vhosts/example.org/lib/spawningdaemon.php(189): ImDaemon->runThread()
 in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php on line 567
PHP Fatal error:  Uncaught Error: Function name must be a string in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php:567

PHP Fatal error:  Uncaught Error: Call to undefined function split() in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php:266
Stack trace:
0 /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMPP.php(129): XMPPHP_XMLStream->addXPathHandler('{http://etherx....', 'features_handle...')
1 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(145): XMPPHP_XMPP->__construct('geekplace.eu', 5222, 'gnusocial', 'U^k&l5fV53duGy', 'gnusocial', 'geekplace.eu', false, NULL)
2 /var/vhosts/example.org/plugins/Xmpp/lib/xmppmanager.php(49): XmppManager->connect()
3 /var/vhosts/example.org/lib/iomaster.php(248): XmppManager->start(Object(ImMaster))
4 /var/vhosts/example.org/lib/iomaster.php(111): IoMaster->start()
5 /var/vhosts/example.org/scripts/imdaemon.php(58): IoMaster->service()
6 /var/vhosts/example.org/lib/spawningdaemon.php(189): ImDaemon->runThread()
7 /var/vhosts/example.org/lib/spawningdaemon.php(118): SpawningDaemon->initAndRunChild(1 in /var/vhosts/example.org/plugins/Xmpp/extlib/XMPPHP/XMLStream.php on line 266
This commit is contained in:
Florian Schmaus 2017-08-19 17:55:47 +02:00
parent 7785219234
commit e615032331
2 changed files with 6 additions and 6 deletions

View File

@ -118,7 +118,7 @@ class Roster {
* @param string $status * @param string $status
*/ */
public function setPresence($presence, $priority, $show, $status) { public function setPresence($presence, $priority, $show, $status) {
list($jid, $resource) = split("/", $presence); list($jid, $resource) = explode("/", $presence);
if ($show != 'unavailable') { if ($show != 'unavailable') {
if (!$this->isContact($jid)) { if (!$this->isContact($jid)) {
$this->addContact($jid, 'not-in-roster'); $this->addContact($jid, 'not-in-roster');
@ -137,7 +137,7 @@ class Roster {
* @param string $jid * @param string $jid
*/ */
public function getPresence($jid) { public function getPresence($jid) {
$split = split("/", $jid); $split = explode("/", $jid);
$jid = $split[0]; $jid = $split[0];
if($this->isContact($jid)) { if($this->isContact($jid)) {
$current = array('resource' => '', 'active' => '', 'priority' => -129, 'show' => '', 'status' => ''); //Priorities can only be -128 = 127 $current = array('resource' => '', 'active' => '', 'priority' => -129, 'show' => '', 'status' => ''); //Priorities can only be -128 = 127

View File

@ -263,7 +263,7 @@ class XMPPHP_XMLStream {
$ns_tags = array($xpath); $ns_tags = array($xpath);
} }
foreach($ns_tags as $ns_tag) { foreach($ns_tags as $ns_tag) {
list($l, $r) = split("}", $ns_tag); list($l, $r) = explode("}", $ns_tag);
if ($r != null) { if ($r != null) {
$xpart = array(substr($l, 1), $r); $xpart = array(substr($l, 1), $r);
} else { } else {
@ -564,7 +564,7 @@ class XMPPHP_XMLStream {
if ($searchxml !== null) { if ($searchxml !== null) {
if($handler[2] === null) $handler[2] = $this; if($handler[2] === null) $handler[2] = $this;
$this->log->log("Calling {$handler[1]}", XMPPHP_Log::LEVEL_DEBUG); $this->log->log("Calling {$handler[1]}", XMPPHP_Log::LEVEL_DEBUG);
$handler[2]->$handler[1]($this->xmlobj[2]); $handler[2]->{$handler[1]}($this->xmlobj[2]);
} }
} }
} }
@ -584,7 +584,7 @@ class XMPPHP_XMLStream {
foreach($this->idhandlers as $id => $handler) { foreach($this->idhandlers as $id => $handler) {
if(array_key_exists('id', $this->xmlobj[2]->attrs) and $this->xmlobj[2]->attrs['id'] == $id) { if(array_key_exists('id', $this->xmlobj[2]->attrs) and $this->xmlobj[2]->attrs['id'] == $id) {
if($handler[1] === null) $handler[1] = $this; if($handler[1] === null) $handler[1] = $this;
$handler[1]->$handler[0]($this->xmlobj[2]); $handler[1]->{$handler[0]}($this->xmlobj[2]);
#id handlers are only used once #id handlers are only used once
unset($this->idhandlers[$id]); unset($this->idhandlers[$id]);
break; break;
@ -640,7 +640,7 @@ class XMPPHP_XMLStream {
if($handler[2] === null) { if($handler[2] === null) {
$handler[2] = $this; $handler[2] = $this;
} }
$handler[2]->$handler[1]($payload); $handler[2]->{$handler[1]}($payload);
} }
} }
foreach($this->until as $key => $until) { foreach($this->until as $key => $until) {