Added array_key_exists check

Added array_key_exists check to check for misconfigured environments like Google App Engine
This commit is contained in:
Thijs Scheepers
2014-08-25 11:56:50 +02:00
parent e0389cda4e
commit 1ea65331d7
+5 -3
View File
@@ -32,9 +32,11 @@ class Misc
public static function translateErrorCode($error_code)
{
$constants = get_defined_constants(true);
foreach ($constants['Core'] as $constant => $value) {
if (substr($constant, 0, 2) == 'E_' && $value == $error_code) {
return $constant;
if (array_key_exists('Core' , $constants)) {
foreach ($constants['Core'] as $constant => $value) {
if (substr($constant, 0, 2) == 'E_' && $value == $error_code) {
return $constant;
}
}
}
return "E_UNKNOWN";