Skip to content

Commit

Permalink
Accept empty packets when exploding stream data into arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
baudev committed May 7, 2019
1 parent 3c203e8 commit 475592b
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 475592b

Please sign in to comment.