Skip to content

Commit

Permalink
Merge pull request #6 from baudev/hotfixes
Browse files Browse the repository at this point in the history
Accept empty packets when exploding stream data into an array
  • Loading branch information
baudev authored May 7, 2019
2 parents 3c203e8 + 475592b commit 7f8d02f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ public function stream()
stream_set_timeout($this->getRemote(), 150);
// we set an infinite loop
while (($packetData = $this->read($this->getRemote())) !== 1) {

// we explode the packet after each footer node
$packetArray = preg_split('/(?<=<\/message>)/', $packetData, -1, PREG_SPLIT_NO_EMPTY);
$packetArray = preg_split('/(?<=<\/message>)/', $packetData, -1);
foreach ($packetArray as $packet) {
// make sure that the XML received is well formatted
$validXML = $this->analyzeData($packet);
Expand Down

0 comments on commit 7f8d02f

Please sign in to comment.