Skip to content

Commit

Permalink
strip slashes for SMS text
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiez committed Feb 27, 2023
1 parent ec0339d commit 3ec6f3b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2019-present sms77 e.K.
Copyright (c) 2019-2022 sms77 e.K.
Copyright (c) 2023-present seven communications GmbH & Co. KG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Sms77.io Logo](https://www.sms77.io/wp-content/uploads/2019/07/sms77-Logo-400x79.png "Sms77.io Logo")
![](https://www.seven.io/wp-content/uploads/Logo.svg "seven Logo")

# Official PHP API Client

Expand All @@ -11,7 +11,7 @@ composer require sms77/api
```

Alternatively you
can [download as *.ZIP](https://github.com/sms77io/php-client/releases/latest "download as *.ZIP")
can [download as *.ZIP](https://github.com/seven-io/php-client/releases/latest "download as *.ZIP")
if you don't use Composer.

### Usage
Expand Down Expand Up @@ -162,6 +162,6 @@ particular API key. SMS77_RECIPIENT is the recipient of the test SMS.

###### Support

Need help? Feel free to [contact us](https://www.sms77.io/en/company/contact/).
Need help? Feel free to [contact us](https://www.seven.io/en/company/contact/).

[![MIT](https://img.shields.io/badge/License-MIT-teal.svg)](./LICENSE)
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"authors": [
{
"email": "a.matthies@sms77.io",
"homepage": "https://www.sms77.io",
"name": "sms77 e.K.",
"email": "support@seven.io",
"homepage": "https://www.seven.io",
"name": "seven communications GmbH & Co. KG",
"role": "Developer"
}
],
Expand All @@ -22,8 +22,8 @@
"php": "7.3"
}
},
"description": "Official API Client for requesting the Sms77.io SMS Gateway.",
"homepage": "https://github.com/sms77io/php-client",
"description": "Official API Client for requesting the seven.io SMS Gateway.",
"homepage": "https://github.com/seven-io/php-client",
"keywords": [
"2fa",
"sms",
Expand All @@ -49,10 +49,10 @@
"ext-simplexml": "*"
},
"support": {
"docs": "https://github.com/sms77io/php-client",
"email": "support@sms77.io",
"rss": "https://www.sms77.io/de/feed/",
"source": "https://github.com/sms77io/php-client"
"docs": "https://github.com/seven-io/php-client",
"email": "support@seven.io",
"rss": "https://www.seven.io/en/feed/",
"source": "https://github.com/seven-io/php-client"
},
"type": "library"
}
9 changes: 7 additions & 2 deletions src/BaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ private function request(string $path, string $method, array $options = []) {
];
$url = self::BASE_URI . "/$path";
$params = http_build_query($options);
self::HTTP_GET === $method && $url .= "?$params";
if (self::HTTP_GET === $method) $url .= "?$params";

$ch = curl_init($url);

if (self::HTTP_POST === $method) {
if ($path === 'sms') {
$headers[] = 'Content-Type: application/json';
$params = stripslashes(json_encode($options));

This comment has been minimized.

Copy link
@lsmedia

lsmedia May 24, 2023

Das Entfernen der Slashes zerreißt Zeilenumbrüche und UTF-8 kodierte Sonderzeichen im SMS-Text. Ist das reproduzierbar?

Testausgabe am Endgerät bspw.: Terminbestu00e4tigung:nnWerkstatttermin am 04.08.2023 fu00fcr das Fahrzeug XYZ

...statt:

Terminbestätigung:

Werkstatttermin am 04.08.2023 für das Fahrzeug XYZ

This comment has been minimized.

Copy link
@matthiez

matthiez via email May 24, 2023

Author Member
}

curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_POST, true);
}
Expand Down Expand Up @@ -125,4 +130,4 @@ protected function post(string $path, array $options = []) {
protected function get(string $path, array $options = []) {
return $this->request($path, self::HTTP_GET, $options);
}
}
}

0 comments on commit 3ec6f3b

Please sign in to comment.