diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-11-17 01:40:32 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-11-17 01:40:35 +0100 |
commit | 0372ecf14141ba2c174782f29d4fb079b4dd56c3 (patch) | |
tree | 9ae82327b70b1ffba5604c7bdc5ac1eb6ef47a59 /phpBB/includes | |
parent | 5bc0f4b3d49ed1bea45464beece42906646eb026 (diff) | |
download | forums-0372ecf14141ba2c174782f29d4fb079b4dd56c3.tar forums-0372ecf14141ba2c174782f29d4fb079b4dd56c3.tar.gz forums-0372ecf14141ba2c174782f29d4fb079b4dd56c3.tar.bz2 forums-0372ecf14141ba2c174782f29d4fb079b4dd56c3.tar.xz forums-0372ecf14141ba2c174782f29d4fb079b4dd56c3.zip |
[ticket/11015] Make phpbb_convert_30_dbms_to_31 more future proof
It should allow any class name in the future, as long as that class
exists. And it should give a useful error message otherwise.
PHPBB3-11015
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 045a28672b..57136a43ff 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -5421,10 +5421,15 @@ function phpbb_to_numeric($input) */ function phpbb_convert_30_dbms_to_31($dbms) { - if (!preg_match('#^phpbb_db_driver_#', $dbms)) + if (class_exists($dbms)) { - return 'phpbb_db_driver_'.$dbms; + return $dbms; } - return $dbms; + if (class_exists('phpbb_db_driver_' . $dbms)) + { + return 'phpbb_db_driver_' . $dbms; + } + + throw new \RuntimeException('You have specified an invalid dbms driver.'); } |