diff options
author | Hans Duedal <hd@onlinecity.dk> | 2011-05-05 16:18:38 +0200 |
---|---|---|
committer | Hans Duedal <hd@onlinecity.dk> | 2011-05-05 16:18:38 +0200 |
commit | a09acf90a34f103e2b0b9cf009be7c8c3aaf64c2 (patch) | |
tree | c6f23e5927e0e392a7b1aecdb4e700b68c0d8245 | |
parent | b62500e2b25fd14c3ab25f479026cea0e6a712ab (diff) | |
download | php-smpp-a09acf90a34f103e2b0b9cf009be7c8c3aaf64c2.zip php-smpp-a09acf90a34f103e2b0b9cf009be7c8c3aaf64c2.tar.gz php-smpp-a09acf90a34f103e2b0b9cf009be7c8c3aaf64c2.tar.bz2 |
Fixed return after updating to thrift 0.6.1, removed the remaining namespaces
-rw-r--r-- | protocol/smppclient.class.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/protocol/smppclient.class.php b/protocol/smppclient.class.php index 6f259d9..f88cc19 100644 --- a/protocol/smppclient.class.php +++ b/protocol/smppclient.class.php @@ -162,6 +162,7 @@ class SmppClient // Read pdu do{ $pdu = $this->readPDU(); + if ($pdu === false) return false; // TSocket v. 0.6.0+ returns false on timeout //check for enquire link command if($pdu->id==SMPP::ENQUIRE_LINK){ $this->sendPDU(SMPP::ENQUIRE_LINK_RESP, "", $pdu->sequence); @@ -387,7 +388,7 @@ class SmppClient protected function parseSMS(SmppPdu $pdu) { // Check command id - if($pdu->id != SMPP::DELIVER_SM) throw new \InvalidArgumentException('PDU is not an received SMS'); + if($pdu->id != SMPP::DELIVER_SM) throw new InvalidArgumentException('PDU is not an received SMS'); // Unpack PDU $ar=unpack("C*",$pdu->body); @@ -567,7 +568,7 @@ class SmppClient // Read PDU body if($length-16>0){ $body=$this->transport->readAll($length-16); - if(!$body) throw new \RuntimeException('Could not read PDU body'); + if(!$body) throw new RuntimeException('Could not read PDU body'); } else { $body=null; } @@ -624,7 +625,7 @@ class SmppClient protected function parseTag(&$ar) { $unpackedData = unpack('nid/nlength',pack("C2C2",next($ar),next($ar),next($ar),next($ar))); - if (!$unpackedData) throw new \InvalidArgumentException('Could not read tag data'); + if (!$unpackedData) throw new InvalidArgumentException('Could not read tag data'); extract($unpackedData); // Sometimes SMSC return an extra null byte at the end @@ -645,7 +646,7 @@ class SmppClient } -class SmppException extends \RuntimeException +class SmppException extends RuntimeException { } @@ -917,13 +918,13 @@ class SmppDeliveryReceipt extends SmppSms * Parse a delivery receipt formatted as specified in SMPP v3.4 - Appendix B * It accepts all chars except space as the message id * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function parseDeliveryReceipt() { $numMatches = preg_match('/^id:([^ ]+) sub:(\d{1,3}) dlvrd:(\d{3}) submit date:(\d{10}) done date:(\d{10}) stat:([A-Z]{7}) err:(\d{3}) text:(.*)$/ms', $this->message, $matches); if ($numMatches == 0) { - throw new \InvalidArgumentException('Could not parse delivery receipt: '.$this->message."\n".bin2hex($this->body)); + throw new InvalidArgumentException('Could not parse delivery receipt: '.$this->message."\n".bin2hex($this->body)); } list($matched, $this->id, $this->sub, $this->dlvrd, $this->submitDate, $this->doneDate, $this->stat, $this->err, $this->text) = $matches; |