diff --git a/include/class.crypto.php b/include/class.crypto.php index b169cbb29f4986fa40a989d73a8237e943ac0746..2fd967dba66a990bd8922b504a47492dc2a128da 100644 --- a/include/class.crypto.php +++ b/include/class.crypto.php @@ -69,7 +69,7 @@ class Crypto { * is only really useful for testing. The crypto library will be * automatically selected based on the available PHP extensions. */ - function encrypt($input, $key, $skey='encryption', $crypt=null) { + static function encrypt($input, $key, $skey='encryption', $crypt=null) { //Gets preffered crypto. if(!($crypto = Crypto::get($crypt))) @@ -97,7 +97,7 @@ class Crypto { * skey - (string_ sub key or namespace used originally for the * encryption */ - function decrypt($ciphertext, $key, $skey='encryption') { + static function decrypt($ciphertext, $key, $skey='encryption') { if(!$key || !$ciphertext || $ciphertext[0] != '$') return false; @@ -112,7 +112,7 @@ class Crypto { return $crypto->decrypt(base64_decode($ciphertext)); } - function get($crypt) { + static function get($crypt) { $cryptos = self::cryptos(); if(!$cryptos || ($crypt && !isset($cryptos[$crypt]))) @@ -133,7 +133,7 @@ class Crypto { * Returns list of supported cryptos * */ - function cryptos() { + static function cryptos() { static $cryptos = false; @@ -153,7 +153,7 @@ class Crypto { return $cryptos; } - function hash($string, $key) { + static function hash($string, $key) { $hash = new Crypt_Hash('sha512'); $hash->setKey($key); return $hash->hash($string); @@ -164,7 +164,7 @@ class Crypto { Credit: The routine borrows heavily from PHPSecLib's Crypt_Random package. */ - function random($len) { + static function random($len) { if(CRYPT_IS_WINDOWS) { if (function_exists('openssl_random_pseudo_bytes') diff --git a/include/class.filter.php b/include/class.filter.php index d54bc8fd80a9df8dffaa1cdfc4bd6882f54bf643..7178aece5eba1d0540020b9898f2602bdcdd55df 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -873,7 +873,7 @@ class TicketFilter { * http://msdn.microsoft.com/en-us/library/ee219609(v=exchg.80).aspx */ /* static */ - function isAutoReply($headers) { + static function isAutoReply($headers) { if($headers && !is_array($headers)) $headers = Mail_Parse::splitHeaders($headers); diff --git a/include/class.i18n.php b/include/class.i18n.php index 0dc60bde0707e682bd2ce4d774fdafbfce88bc4a..17709bee89b112527e2158910641d18608c64555 100644 --- a/include/class.i18n.php +++ b/include/class.i18n.php @@ -410,7 +410,7 @@ class Internationalization { static function getCSVDelimiter($locale='') { - if (!$locale) // Prefer browser settings + if (!$locale && extension_loaded('intl')) // Prefer browser settings $locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); // Detect delimeter from the current locale settings. For locales diff --git a/include/class.mailparse.php b/include/class.mailparse.php index a38027ebb724088a3705987a89a498c7bc96e822..58eb2a984e157f17ba0a0d87b3b295aedfeb420e 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -152,7 +152,7 @@ class Mail_Parse { * the header key. If left as FALSE, only the value given in the last * occurance of the header is retained. */ - /* static */ function splitHeaders($headers_text, $as_array=false) { + static function splitHeaders($headers_text, $as_array=false) { $headers = preg_split("/\r?\n/", $headers_text); for ($i=0, $k=count($headers); $i<$k; $i++) { // first char might be whitespace (" " or "\t") diff --git a/include/class.queue.php b/include/class.queue.php index a6521bc10afc14d8f4ee67b8a8b923231a33f2dd..b037d4eee0769d5e7ad4d291e1cc5e24d1b9537e 100644 --- a/include/class.queue.php +++ b/include/class.queue.php @@ -362,7 +362,7 @@ class CustomQueue extends VerySimpleModel { if (function_exists('collator_create')) { $coll = Collator::create(Internationalization::getCurrentLanguage()); $keys = array_map(function($a) use ($coll) { - return $coll->getSortKey($a[0]); + return $coll->getSortKey($a[0]); #nolint }, $fields); } else { diff --git a/include/class.validator.php b/include/class.validator.php index 14be7ccaf005423bf34c395aa375c04227e9671e..97f79bc8a0d77ef5900e9c46b13dbdf3fc05a221 100644 --- a/include/class.validator.php +++ b/include/class.validator.php @@ -144,7 +144,7 @@ class Validator { require_once PEAR_DIR . 'Mail/RFC822.php'; require_once PEAR_DIR . 'PEAR.php'; $rfc822 = new Mail_RFC822(); - if (!($mails = $rfc822->parseAddressList($email)) || PEAR::isError($mails)) + if (!($mails = @$rfc822->parseAddressList($email)) || PEAR::isError($mails)) return false; if (!$list && count($mails) > 1) diff --git a/setup/test/tests/stubs.php b/setup/test/tests/stubs.php index 052f97d3ac61235cbcb7123cd6e8160ab9ee5234..0ad23392642a6e1d4cedd18e7876e44fd1972d35 100644 --- a/setup/test/tests/stubs.php +++ b/setup/test/tests/stubs.php @@ -121,6 +121,7 @@ class finfo { class Locale { function getDisplayName() {} + function acceptFromHttp() {} } class IntlBreakIterator { static function createWordInstance() {} diff --git a/setup/test/tests/test.mail-parse.php b/setup/test/tests/test.mail-parse.php index 8d1350f0f178cc4d9d81f73b5561e25a4075f66a..897851d06c548297654c92d6eb3ca358dcafa035 100644 --- a/setup/test/tests/test.mail-parse.php +++ b/setup/test/tests/test.mail-parse.php @@ -43,7 +43,7 @@ Q2hlZXJzISE= --=_28022448a1f58a3af7edf57ff2e3af44-- EOF; - $result = EmailDataParser::parse($email); + $result = @EmailDataParser::parse($email); $this->assert(count($result['recipients']) == 1, 'Expected 1 recipient'); $this->assert($result['recipients'][0]['source'] == 'delivered-to', 'Delivered-To header used as a collaborator'); diff --git a/setup/test/tests/test.undefinedmethods.php b/setup/test/tests/test.undefinedmethods.php index c767ba6ac1490c265be68b821419d348ff30fdce..83a227eeeae0da98b146908f50055c2b2387ff97 100644 --- a/setup/test/tests/test.undefinedmethods.php +++ b/setup/test/tests/test.undefinedmethods.php @@ -36,6 +36,10 @@ function find_function_calls($scripts) { $lineno=0; foreach ($lines as $line) { $lineno++; $matches=array(); + // Ignore what looks like within comments (#|/|*) + if (preg_match('/^(\s*?)(#|\/|\*)/m', $line)) + continue; + preg_match_all('/^.*\w+(?:-[>]|::)([a-zA-Z0-9_]+)\(.*/', $line, $matches, PREG_SET_ORDER); foreach ($matches as $m)