Commit 2839a29f authored by skummer's avatar skummer

ZP-267 #comment do get_defined_constants(false) to prevent crashes on RHEL 6 #time 30m

git-svn-id: https://z-push.org/svn/z-push/trunk@1491 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 75c454b1
......@@ -99,19 +99,22 @@ function get_mapi_error_name($errcode=null)
$errcode = mapi_last_hresult();
}
if ($errcode !== 0){
$allConstants = get_defined_constants(true);
foreach($allConstants['user'] as $key => $value){
$prefix = substr($key, 0, 7);
if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") {
/**
* If PHP encounters a number beyond the bounds of the integer type,
* it will be interpreted as a float instead, so when comparing these error codes
* we have to manually typecast value to integer, so float will be converted in integer,
* but still its out of bound for integer limit so it will be auto adjusted to minus value
*/
if ($errcode == (int) $value){
if ($errcode !== 0) {
// get_defined_constants(true) is preferred, but crashes PHP
// https://bugs.php.net/bug.php?id=61156
$allConstants = get_defined_constants();
foreach ($allConstants as $key => $value) {
/**
* If PHP encounters a number beyond the bounds of the integer type,
* it will be interpreted as a float instead, so when comparing these error codes
* we have to manually typecast value to integer, so float will be converted in integer,
* but still its out of bound for integer limit so it will be auto adjusted to minus value
*/
if ($errcode == (int) $value) {
// Check that we have an actual MAPI error or warning definition
$prefix = substr($key, 0, 7);
if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") {
return $key;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment