aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2018-11-15 19:36:01 +0100
committerGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2018-11-15 19:36:01 +0100
commit1b34d9860e0b14da43b38cdacedc91ea884221b3 (patch)
treeabfa9639908c10cb33bb6559056593ef421705c5
parent6e70d461e1877cc51ecfda1081a2cb42ebfb7364 (diff)
downloadrss-bridge-1b34d9860e0b14da43b38cdacedc91ea884221b3.tar.gz
rss-bridge-1b34d9860e0b14da43b38cdacedc91ea884221b3.tar.zst
rss-bridge-1b34d9860e0b14da43b38cdacedc91ea884221b3.zip
[Cache] Check if class is instantiable
-rw-r--r--lib/Cache.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Cache.php b/lib/Cache.php
index 309d0c3b..a0d2ac77 100644
--- a/lib/Cache.php
+++ b/lib/Cache.php
@@ -61,7 +61,7 @@ class Cache {
* @throws \Exception if the requested cache file doesn't exist in the
* working directory.
* @param string $name Name of the cache object.
- * @return object The cache object.
+ * @return object|bool The cache object or false if the class is not instantiable.
*/
public static function create($name){
if(!self::isCacheName($name)) {
@@ -76,7 +76,11 @@ class Cache {
require_once $filePath;
- return new $name();
+ if((new \ReflectionClass($name))->isInstantiable()) {
+ return new $name();
+ }
+
+ return false;
}
/**