Skip to content

Commit 2534cc6

Browse files
committed
add strict str_is
1 parent 620fdda commit 2534cc6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Illuminate/Support/Str.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public static function is($pattern, $value)
251251
// If the given value is an exact match we can of course return true right
252252
// from the beginning. Otherwise, we will translate asterisks and do an
253253
// actual pattern match against the two strings to see if they match.
254-
if ($pattern == $value) {
254+
if ($pattern === $value) {
255255
return true;
256256
}
257257

tests/Support/SupportStrTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ public function testIs()
264264

265265
// empty patterns
266266
$this->assertFalse(Str::is([], 'test'));
267+
268+
$this->assertFalse( Str::is('', 0));
269+
$this->assertFalse( Str::is([null], 0));
270+
$this->assertTrue( Str::is([null], null));
267271
}
268272

269273
/**

0 commit comments

Comments
 (0)