Last active
December 23, 2015 12:29
-
-
Save mrvdb/6635734 to your computer and use it in GitHub Desktop.
Fix for 'Undefined offset: 1 (/usr/local/statusnet/lib/liberalstomp.php:136)' messages in statusnet log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/liberalstomp.php b/lib/liberalstomp.php | |
index 70c22c1..3a2358c 100644 | |
--- a/lib/liberalstomp.php | |
+++ b/lib/liberalstomp.php | |
@@ -77,7 +77,7 @@ class LiberalStomp extends Stomp | |
if (!$this->hasFrameToRead()) { | |
return false; | |
} | |
- | |
+ | |
$rb = 1024; | |
$data = ''; | |
$end = false; | |
@@ -116,7 +116,7 @@ class LiberalStomp extends Stomp | |
return array_map(array($this, 'parseFrame'), $frames); | |
} | |
- | |
+ | |
/** | |
* Parse a raw Stomp frame into an object. | |
* Extracted from Stomp::readFrame() | |
@@ -129,9 +129,10 @@ class LiberalStomp extends Stomp | |
list ($header, $body) = explode("\n\n", $data, 2); | |
$header = explode("\n", $header); | |
$headers = array(); | |
- $command = null; | |
+ unset($command); | |
foreach ($header as $v) { | |
- if (isset($command)) { | |
+ if (isset($command) and !empty($command)) { | |
list ($name, $value) = explode(':', $v, 2); | |
$headers[$name] = $value; | |
} else { | |
@@ -173,4 +174,3 @@ class LiberalStomp extends Stomp | |
} | |
} | |
} | |
- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment