laravel/framework — pull request #2603 by vlakoff (2013-10-31 01:08:49+00:00)
Title: Fix issue in Str::finish() with multicharacter cap.

Because the 2nd argument of `trim()` is handled as a character list, and not as a word, `str_finish('ab', 'bc')` was resulting in `abc` instead of the expected `abbc`.

Concerning performances, my proposed method is about 80 % slower than the current one, which I think is still reasonable. For the record, I wrote a version without regex, using some `substr()` and a `while`, but it revealed to be 145 % slower than the current one.