Skip to content

Commit

Permalink
Merge branch '5.1' into master
Browse files Browse the repository at this point in the history
* 5.1:
  fix merge
  [Cache] fix previous PR
  add mising sr (latn & cyrl) translations
  [Cache] fix ProxyAdapter not persisting items with infinite expiration
  [HttpClient] fail properly when the server replies with HTTP/0.9
  Fix CS
  [Cache] Limit cache version character range
  [Mailer] Fixed Mailgun API bridge JsonException when API response is not applicaton/json
  [String] improve fix
  fix tests
  [DI] dump OS-indepent paths in the compiled container
  [DI] dump OS-indepent paths in the preload file
  Run postgres setup trigger in transaction
  allow consumers to mock all methods
  • Loading branch information
xabbuh committed Sep 11, 2020
2 parents 497c62c + d732ad8 commit 82a2cb8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions UnicodeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ public function indexOf($needle, int $offset = 0): ?int
return null;
}

if ($this->length() <= $offset) {
try {
$i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);
} catch (\ValueError $e) {
return null;
}

$i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);

return false === $i ? null : $i;
}

Expand Down Expand Up @@ -266,12 +266,12 @@ public function replaceMatches(string $fromRegexp, $to): AbstractString

public function slice(int $start = 0, int $length = null): AbstractString
{
if ($this->length() <= $start) {
return new self();
}

$str = clone $this;
$str->string = (string) grapheme_substr($this->string, $start, $length ?? \PHP_INT_MAX);
try {
$str->string = (string) grapheme_substr($this->string, $start, $length ?? \PHP_INT_MAX);
} catch (\ValueError $e) {
$str->string = '';
}

return $str;
}
Expand Down

0 comments on commit 82a2cb8

Please sign in to comment.