diff --git a/ApnsPHP/Push.php b/ApnsPHP/Push.php index f73f3ad1..09188647 100644 --- a/ApnsPHP/Push.php +++ b/ApnsPHP/Push.php @@ -292,6 +292,10 @@ protected function _parseErrorMessage($sErrorMessage) */ protected function _readErrorMessage() { + $bytesInSocket = socket_get_status($this->_hSocket)['unread_bytes']; + if($bytesInSocket === 0){ + return null; + } $sErrorResponse = @fread($this->_hSocket, self::ERROR_RESPONSE_SIZE); if ($sErrorResponse === false || strlen($sErrorResponse) != self::ERROR_RESPONSE_SIZE) { return;