Skip to content

Commit

Permalink
1.0.8 Better json decoding, ignoring chr(13)
Browse files Browse the repository at this point in the history
  • Loading branch information
multiOTP committed Mar 30, 2023
1 parent f02a840 commit 6aa4d12
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SMSGateway Change Log

## Version 1.0.7 (2023-03-30)
## Version 1.0.8 (2023-03-30)

### Fixed bugs
* Better json decoding, ignoring chr(13)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.6
1.0.8
4 changes: 2 additions & 2 deletions examples/gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* PHP 5.3.0 or higher is supported.
*
* @author Andre Liechti (SysCo systemes de communication sa) <[email protected]>
* @version 1.1.0
* @date 2023-03-21
* @version 1.1.1
* @date 2023-03-30
* @since 2022-09-10
* @copyright (c) 2022-2023 SysCo systemes de communication sa
* @copyright GNU Lesser General Public License
Expand Down
9 changes: 5 additions & 4 deletions src/SMSGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* PHP 5.3.0 or higher is supported.
*
* @author Andre Liechti (SysCo systemes de communication sa) <[email protected]>
* @version 1.0.7
* @version 1.0.8
* @date 2023-03-30
* @since 2022-09-10
* @copyright (c) 2022-2023 SysCo systemes de communication sa
Expand Down Expand Up @@ -421,7 +421,7 @@ public function handleMessages(
$post_data
) {
$result_array = array();
$extract_data = json_decode($post_data, true);
$extract_data = json_decode(str_replace(chr(13), "", $post_data), true);
if (null != $extract_data) {
if (isset($extract_data["messages"])) {
foreach($extract_data["messages"] as $message) {
Expand Down Expand Up @@ -457,15 +457,15 @@ public function handleUpdates(
$post_data
) {
$result_array = array();
$extract_data = json_decode($post_data, true);
$extract_data = json_decode(str_replace(chr(13), "", $post_data), true);
if (null != $extract_data) {
if (isset($extract_data["updates"])) {
foreach($extract_data["updates"] as $update) {
if (isset($update["id"])) {
if (isset($update["status"])) {
$message_array = glob($this->getDevicePathSend() . $update["id"] . ".*");
if (1 == count($message_array)) {
$extract_data = json_decode(file_get_contents($message_array[0]), true);
$extract_data = json_decode(str_replace(chr(13), "", file_get_contents($message_array[0])), true);
$content = "";
$to = "";
if (null != $extract_data) {
Expand All @@ -481,6 +481,7 @@ public function handleUpdates(
]);
$updated_message = $this->getDevicePathSend() . $update["id"] . "." . $update["status"];
rename($message_array[0], $updated_message);
touch($updated_message);
}
}
}
Expand Down

0 comments on commit 6aa4d12

Please sign in to comment.