diff --git a/src/Stringy.php b/src/Stringy.php index 4cb6100..017f6ac 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -637,7 +637,7 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess $startOfStr = mb_strtolower($startOfStr, $this->encoding); } - return $substring === $startOfStr; + return (string) $substring === $startOfStr; } /** @@ -662,7 +662,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 f20f5cc..8649318 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'), @@ -768,6 +772,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'),