Skip to content

Commit efb67f8

Browse files
committed
FIX Add null check to ClassInfo::hasTable.
1 parent cf367b3 commit efb67f8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Core/ClassInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static function hasTable($tableName)
9393
// Cache the list of all table names to reduce on DB traffic
9494
$cache->set($cacheKey, $tableList);
9595
}
96-
return !empty($tableList[strtolower($tableName)]);
96+
return !empty($tableList[strtolower($tableName ?? '')]);
9797
}
9898

9999
private static function getCache(): CacheInterface

tests/php/Core/ClassInfoTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ public function testHasMethod($object, $method, $output)
286286
);
287287
}
288288

289+
public function testHasTable()
290+
{
291+
$this->assertFalse(ClassInfo::hasTable(null));
292+
}
293+
289294
public function provideHasMethodCases()
290295
{
291296
return [

0 commit comments

Comments
 (0)