Skip to content

Commit

Permalink
fix #481 core_sanitize_sender() that sanitizes sender ID now allows a…
Browse files Browse the repository at this point in the history
…lphanumeric, space, dash and underscore
  • Loading branch information
antonraharja committed Aug 23, 2015
1 parent 0694440 commit 24363c2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions web/lib/fn_core.php
Expand Up @@ -573,13 +573,16 @@ function core_sanitize_numeric($string) {
/**
* Sanitize SMS sender
*/
function core_sanitize_sender($text) {
$text = core_sanitize_alphanumeric($text);
$text = substr($text, 0, 16);
if (preg_match("/^[A-Za-z]/", $text) == TRUE) {
$text = substr($text, 0, 11);
function core_sanitize_sender($string) {
// $string = core_sanitize_alphanumeric($string);
// allows alphanumeric, space, dash, underscore
$string = trim(preg_replace('/[^\p{L}\p{N}]\s-_+/u', '', $string));
$string = substr($string, 0, 16);
if (preg_match('/[^\p{L}\p{N}]\s-_+/u', $string) == TRUE) {
$string = substr($string, 0, 11);
}
return $text;

return $string;
}

/**
Expand Down

1 comment on commit 24363c2

@pesaply
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks For The Change ,, I will Make Sure i bring something back to the community

Please sign in to comment.