diff --git a/src/Stringy.php b/src/Stringy.php index 340517c..364c8eb 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -646,7 +646,7 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess $startOfStr = mb_strtolower($startOfStr, $this->encoding); } - return $substring === $startOfStr; + return (string) $substring === $startOfStr; } /** @@ -671,7 +671,7 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess $endOfStr = mb_strtolower($endOfStr, $this->encoding); } - return $substring === $endOfStr; + return (string) $substring === $endOfStr; } /** diff --git a/tests/CommonTest.php b/tests/CommonTest.php index 0f5ca0b..b25b1a7 100644 --- a/tests/CommonTest.php +++ b/tests/CommonTest.php @@ -1,5 +1,7 @@ first(1), 'UTF-8'), + array('oo bar', 'foo bar', Stringy::create('foo bar')->at(0), 'UTF-8'), array('fòô bàř', 'fòô bàř', '', 'UTF-8'), array('òô bàř', 'fòô bàř', 'f', 'UTF-8'), array('bàř', 'fòô bàř', 'fòô ', 'UTF-8'), @@ -772,6 +776,8 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase array('foo', 'foo bar', ' bar'), array('foo bar', 'foo bar', 'ba'), array('foo bar', 'foo bar', 'foo ba'), + array('foo ba', 'foo bar', Stringy::create('foo bar')->last(1), 'UTF-8'), + array('foo ba', 'foo bar', Stringy::create('foo bar')->at(6), 'UTF-8'), array('fòô bàř', 'fòô bàř', '', 'UTF-8'), array('fòô bà', 'fòô bàř', 'ř', 'UTF-8'), array('fòô', 'fòô bàř', ' bàř', 'UTF-8'),