+ * if (String::is_ascii($someString))
+ * {
+ * // It's just ASCII - use the native PHP version
+ * $someString = strtolower($someString);
+ * }
+ * else
+ * {
+ * $someString = String::strtolower($someString);
+ * }
+ *
+ *
+ * @param string $str The string to test.
+ *
+ * @return boolean True if the string is all ASCII
+ *
+ * @since 1.0
+ */
+ public static function is_ascii($str)
+ {
+ // Search for any bytes which are outside the ASCII range...
+ return (preg_match('/(?:[^\x00-\x7F])/', $str) !== 1);
+ }
+
+ /**
+ * UTF-8 aware alternative to strpos.
+ *
+ * Find position of first occurrence of a string.
+ *
+ * @param string $str String being examined
+ * @param string $search String being searched for
+ * @param integer $offset Optional, specifies the position from which the search should be performed
+ *
+ * @return mixed Number of characters before the first match or FALSE on failure
+ *
+ * @see http://www.php.net/strpos
+ * @since 1.0
+ */
+ public static function strpos($str, $search, $offset = false)
+ {
+ if ($offset === false)
+ {
+ return utf8_strpos($str, $search);
+ }
+ else
+ {
+ return utf8_strpos($str, $search, $offset);
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to strrpos
+ * Finds position of last occurrence of a string
+ *
+ * @param string $str String being examined.
+ * @param string $search String being searched for.
+ * @param integer $offset Offset from the left of the string.
+ *
+ * @return mixed Number of characters before the last match or false on failure
+ *
+ * @see http://www.php.net/strrpos
+ * @since 1.0
+ */
+ public static function strrpos($str, $search, $offset = 0)
+ {
+ return utf8_strrpos($str, $search, $offset);
+ }
+
+ /**
+ * UTF-8 aware alternative to substr
+ * Return part of a string given character offset (and optionally length)
+ *
+ * @param string $str String being processed
+ * @param integer $offset Number of UTF-8 characters offset (from left)
+ * @param integer $length Optional length in UTF-8 characters from offset
+ *
+ * @return mixed string or FALSE if failure
+ *
+ * @see http://www.php.net/substr
+ * @since 1.0
+ */
+ public static function substr($str, $offset, $length = false)
+ {
+ if ($length === false)
+ {
+ return utf8_substr($str, $offset);
+ }
+ else
+ {
+ return utf8_substr($str, $offset, $length);
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to strtlower
+ *
+ * Make a string lowercase
+ * Note: The concept of a characters "case" only exists is some alphabets
+ * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
+ * not exist in the Chinese alphabet, for example. See Unicode Standard
+ * Annex #21: Case Mappings
+ *
+ * @param string $str String being processed
+ *
+ * @return mixed Either string in lowercase or FALSE is UTF-8 invalid
+ *
+ * @see http://www.php.net/strtolower
+ * @since 1.0
+ */
+ public static function strtolower($str)
+ {
+ return utf8_strtolower($str);
+ }
+
+ /**
+ * UTF-8 aware alternative to strtoupper
+ * Make a string uppercase
+ * Note: The concept of a characters "case" only exists is some alphabets
+ * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
+ * not exist in the Chinese alphabet, for example. See Unicode Standard
+ * Annex #21: Case Mappings
+ *
+ * @param string $str String being processed
+ *
+ * @return mixed Either string in uppercase or FALSE is UTF-8 invalid
+ *
+ * @see http://www.php.net/strtoupper
+ * @since 1.0
+ */
+ public static function strtoupper($str)
+ {
+ return utf8_strtoupper($str);
+ }
+
+ /**
+ * UTF-8 aware alternative to strlen.
+ *
+ * Returns the number of characters in the string (NOT THE NUMBER OF BYTES),
+ *
+ * @param string $str UTF-8 string.
+ *
+ * @return integer Number of UTF-8 characters in string.
+ *
+ * @see http://www.php.net/strlen
+ * @since 1.0
+ */
+ public static function strlen($str)
+ {
+ return utf8_strlen($str);
+ }
+
+ /**
+ * UTF-8 aware alternative to str_ireplace
+ * Case-insensitive version of str_replace
+ *
+ * @param string $search String to search
+ * @param string $replace Existing string to replace
+ * @param string $str New string to replace with
+ * @param integer $count Optional count value to be passed by referene
+ *
+ * @return string UTF-8 String
+ *
+ * @see http://www.php.net/str_ireplace
+ * @since 1.0
+ */
+ public static function str_ireplace($search, $replace, $str, $count = null)
+ {
+ require_once __DIR__ . '/phputf8/str_ireplace.php';
+
+ if ($count === false)
+ {
+ return utf8_ireplace($search, $replace, $str);
+ }
+ else
+ {
+ return utf8_ireplace($search, $replace, $str, $count);
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to str_split
+ * Convert a string to an array
+ *
+ * @param string $str UTF-8 encoded string to process
+ * @param integer $split_len Number to characters to split string by
+ *
+ * @return array
+ *
+ * @see http://www.php.net/str_split
+ * @since 1.0
+ */
+ public static function str_split($str, $split_len = 1)
+ {
+ require_once __DIR__ . '/phputf8/str_split.php';
+
+ return utf8_str_split($str, $split_len);
+ }
+
+ /**
+ * UTF-8/LOCALE aware alternative to strcasecmp
+ * A case insensitive string comparison
+ *
+ * @param string $str1 string 1 to compare
+ * @param string $str2 string 2 to compare
+ * @param mixed $locale The locale used by strcoll or false to use classical comparison
+ *
+ * @return integer < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
+ *
+ * @see http://www.php.net/strcasecmp
+ * @see http://www.php.net/strcoll
+ * @see http://www.php.net/setlocale
+ * @since 1.0
+ */
+ public static function strcasecmp($str1, $str2, $locale = false)
+ {
+ if ($locale)
+ {
+ // Get current locale
+ $locale0 = setlocale(LC_COLLATE, 0);
+
+ if (!$locale = setlocale(LC_COLLATE, $locale))
+ {
+ $locale = $locale0;
+ }
+
+ // See if we have successfully set locale to UTF-8
+ if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m))
+ {
+ $encoding = 'CP' . $m[1];
+ }
+ elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8'))
+ {
+ $encoding = 'UTF-8';
+ }
+ else
+ {
+ $encoding = 'nonrecodable';
+ }
+
+ // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode
+ if ($encoding == 'UTF-8' || $encoding == 'nonrecodable')
+ {
+ return strcoll(utf8_strtolower($str1), utf8_strtolower($str2));
+ }
+ else
+ {
+ return strcoll(
+ self::transcode(utf8_strtolower($str1), 'UTF-8', $encoding),
+ self::transcode(utf8_strtolower($str2), 'UTF-8', $encoding)
+ );
+ }
+ }
+ else
+ {
+ return utf8_strcasecmp($str1, $str2);
+ }
+ }
+
+ /**
+ * UTF-8/LOCALE aware alternative to strcmp
+ * A case sensitive string comparison
+ *
+ * @param string $str1 string 1 to compare
+ * @param string $str2 string 2 to compare
+ * @param mixed $locale The locale used by strcoll or false to use classical comparison
+ *
+ * @return integer < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
+ *
+ * @see http://www.php.net/strcmp
+ * @see http://www.php.net/strcoll
+ * @see http://www.php.net/setlocale
+ * @since 1.0
+ */
+ public static function strcmp($str1, $str2, $locale = false)
+ {
+ if ($locale)
+ {
+ // Get current locale
+ $locale0 = setlocale(LC_COLLATE, 0);
+
+ if (!$locale = setlocale(LC_COLLATE, $locale))
+ {
+ $locale = $locale0;
+ }
+
+ // See if we have successfully set locale to UTF-8
+ if (!stristr($locale, 'UTF-8') && stristr($locale, '_') && preg_match('~\.(\d+)$~', $locale, $m))
+ {
+ $encoding = 'CP' . $m[1];
+ }
+ elseif (stristr($locale, 'UTF-8') || stristr($locale, 'utf8'))
+ {
+ $encoding = 'UTF-8';
+ }
+ else
+ {
+ $encoding = 'nonrecodable';
+ }
+
+ // If we successfully set encoding it to utf-8 or encoding is sth weird don't recode
+ if ($encoding == 'UTF-8' || $encoding == 'nonrecodable')
+ {
+ return strcoll($str1, $str2);
+ }
+ else
+ {
+ return strcoll(self::transcode($str1, 'UTF-8', $encoding), self::transcode($str2, 'UTF-8', $encoding));
+ }
+ }
+ else
+ {
+ return strcmp($str1, $str2);
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to strcspn
+ * Find length of initial segment not matching mask
+ *
+ * @param string $str The string to process
+ * @param string $mask The mask
+ * @param integer $start Optional starting character position (in characters)
+ * @param integer $length Optional length
+ *
+ * @return integer The length of the initial segment of str1 which does not contain any of the characters in str2
+ *
+ * @see http://www.php.net/strcspn
+ * @since 1.0
+ */
+ public static function strcspn($str, $mask, $start = null, $length = null)
+ {
+ require_once __DIR__ . '/phputf8/strcspn.php';
+
+ if ($start === false && $length === false)
+ {
+ return utf8_strcspn($str, $mask);
+ }
+ elseif ($length === false)
+ {
+ return utf8_strcspn($str, $mask, $start);
+ }
+ else
+ {
+ return utf8_strcspn($str, $mask, $start, $length);
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to stristr
+ * Returns all of haystack from the first occurrence of needle to the end.
+ * needle and haystack are examined in a case-insensitive manner
+ * Find first occurrence of a string using case insensitive comparison
+ *
+ * @param string $str The haystack
+ * @param string $search The needle
+ *
+ * @return string the sub string
+ *
+ * @see http://www.php.net/stristr
+ * @since 1.0
+ */
+ public static function stristr($str, $search)
+ {
+ require_once __DIR__ . '/phputf8/stristr.php';
+
+ return utf8_stristr($str, $search);
+ }
+
+ /**
+ * UTF-8 aware alternative to strrev
+ * Reverse a string
+ *
+ * @param string $str String to be reversed
+ *
+ * @return string The string in reverse character order
+ *
+ * @see http://www.php.net/strrev
+ * @since 1.0
+ */
+ public static function strrev($str)
+ {
+ require_once __DIR__ . '/phputf8/strrev.php';
+
+ return utf8_strrev($str);
+ }
+
+ /**
+ * UTF-8 aware alternative to strspn
+ * Find length of initial segment matching mask
+ *
+ * @param string $str The haystack
+ * @param string $mask The mask
+ * @param integer $start Start optional
+ * @param integer $length Length optional
+ *
+ * @return integer
+ *
+ * @see http://www.php.net/strspn
+ * @since 1.0
+ */
+ public static function strspn($str, $mask, $start = null, $length = null)
+ {
+ require_once __DIR__ . '/phputf8/strspn.php';
+
+ if ($start === null && $length === null)
+ {
+ return utf8_strspn($str, $mask);
+ }
+ elseif ($length === null)
+ {
+ return utf8_strspn($str, $mask, $start);
+ }
+ else
+ {
+ return utf8_strspn($str, $mask, $start, $length);
+ }
+ }
+
+ /**
+ * UTF-8 aware substr_replace
+ * Replace text within a portion of a string
+ *
+ * @param string $str The haystack
+ * @param string $repl The replacement string
+ * @param integer $start Start
+ * @param integer $length Length (optional)
+ *
+ * @return string
+ *
+ * @see http://www.php.net/substr_replace
+ * @since 1.0
+ */
+ public static function substr_replace($str, $repl, $start, $length = null)
+ {
+ // Loaded by library loader
+ if ($length === false)
+ {
+ return utf8_substr_replace($str, $repl, $start);
+ }
+ else
+ {
+ return utf8_substr_replace($str, $repl, $start, $length);
+ }
+ }
+
+ /**
+ * UTF-8 aware replacement for ltrim()
+ *
+ * Strip whitespace (or other characters) from the beginning of a string
+ * You only need to use this if you are supplying the charlist
+ * optional arg and it contains UTF-8 characters. Otherwise ltrim will
+ * work normally on a UTF-8 string
+ *
+ * @param string $str The string to be trimmed
+ * @param string $charlist The optional charlist of additional characters to trim
+ *
+ * @return string The trimmed string
+ *
+ * @see http://www.php.net/ltrim
+ * @since 1.0
+ */
+ public static function ltrim($str, $charlist = false)
+ {
+ if (empty($charlist) && $charlist !== false)
+ {
+ return $str;
+ }
+
+ require_once __DIR__ . '/phputf8/trim.php';
+
+ if ($charlist === false)
+ {
+ return utf8_ltrim($str);
+ }
+ else
+ {
+ return utf8_ltrim($str, $charlist);
+ }
+ }
+
+ /**
+ * UTF-8 aware replacement for rtrim()
+ * Strip whitespace (or other characters) from the end of a string
+ * You only need to use this if you are supplying the charlist
+ * optional arg and it contains UTF-8 characters. Otherwise rtrim will
+ * work normally on a UTF-8 string
+ *
+ * @param string $str The string to be trimmed
+ * @param string $charlist The optional charlist of additional characters to trim
+ *
+ * @return string The trimmed string
+ *
+ * @see http://www.php.net/rtrim
+ * @since 1.0
+ */
+ public static function rtrim($str, $charlist = false)
+ {
+ if (empty($charlist) && $charlist !== false)
+ {
+ return $str;
+ }
+
+ require_once __DIR__ . '/phputf8/trim.php';
+
+ if ($charlist === false)
+ {
+ return utf8_rtrim($str);
+ }
+ else
+ {
+ return utf8_rtrim($str, $charlist);
+ }
+ }
+
+ /**
+ * UTF-8 aware replacement for trim()
+ * Strip whitespace (or other characters) from the beginning and end of a string
+ * Note: you only need to use this if you are supplying the charlist
+ * optional arg and it contains UTF-8 characters. Otherwise trim will
+ * work normally on a UTF-8 string
+ *
+ * @param string $str The string to be trimmed
+ * @param string $charlist The optional charlist of additional characters to trim
+ *
+ * @return string The trimmed string
+ *
+ * @see http://www.php.net/trim
+ * @since 1.0
+ */
+ public static function trim($str, $charlist = false)
+ {
+ if (empty($charlist) && $charlist !== false)
+ {
+ return $str;
+ }
+
+ require_once __DIR__ . '/phputf8/trim.php';
+
+ if ($charlist === false)
+ {
+ return utf8_trim($str);
+ }
+ else
+ {
+ return utf8_trim($str, $charlist);
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to ucfirst
+ * Make a string's first character uppercase or all words' first character uppercase
+ *
+ * @param string $str String to be processed
+ * @param string $delimiter The words delimiter (null means do not split the string)
+ * @param string $newDelimiter The new words delimiter (null means equal to $delimiter)
+ *
+ * @return string If $delimiter is null, return the string with first character as upper case (if applicable)
+ * else consider the string of words separated by the delimiter, apply the ucfirst to each words
+ * and return the string with the new delimiter
+ *
+ * @see http://www.php.net/ucfirst
+ * @since 1.0
+ */
+ public static function ucfirst($str, $delimiter = null, $newDelimiter = null)
+ {
+ require_once __DIR__ . '/phputf8/ucfirst.php';
+
+ if ($delimiter === null)
+ {
+ return utf8_ucfirst($str);
+ }
+ else
+ {
+ if ($newDelimiter === null)
+ {
+ $newDelimiter = $delimiter;
+ }
+
+ return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str)));
+ }
+ }
+
+ /**
+ * UTF-8 aware alternative to ucwords
+ * Uppercase the first character of each word in a string
+ *
+ * @param string $str String to be processed
+ *
+ * @return string String with first char of each word uppercase
+ *
+ * @see http://www.php.net/ucwords
+ * @since 1.0
+ */
+ public static function ucwords($str)
+ {
+ require_once __DIR__ . '/phputf8/ucwords.php';
+
+ return utf8_ucwords($str);
+ }
+
+ /**
+ * Transcode a string.
+ *
+ * @param string $source The string to transcode.
+ * @param string $from_encoding The source encoding.
+ * @param string $to_encoding The target encoding.
+ *
+ * @return mixed The transcoded string, or null if the source was not a string.
+ *
+ * @link https://bugs.php.net/bug.php?id=48147
+ *
+ * @since 1.0
+ */
+ public static function transcode($source, $from_encoding, $to_encoding)
+ {
+ if (is_string($source))
+ {
+ switch (ICONV_IMPL)
+ {
+ case 'glibc':
+ return @iconv($from_encoding, $to_encoding . '//TRANSLIT,IGNORE', $source);
+
+ case 'libiconv':
+ default:
+ return iconv($from_encoding, $to_encoding . '//IGNORE//TRANSLIT', $source);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard.
+ *
+ * Note: this function has been modified to simple return true or false.
+ *
+ * @param string $str UTF-8 encoded string.
+ *
+ * @return boolean true if valid
+ *
+ * @author '; - foreach ($this->errors as $error) { - print_r($error); - } - echo ''; + echo '
'; + foreach ($this->error as $single_error) { + print_r($single_error); } + echo ''; } /** @@ -386,12 +406,12 @@ private function setError($error) */ private function catchWarning($errno, $errstr, $errfile, $errline) { - $this->setError(array( + $this->error[] = array( 'error' => "Connecting to the POP3 server raised a PHP warning: ", 'errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline - )); + ); } } diff --git a/libraries/phpmailer/smtp.php b/libraries/vendor/phpmailer/phpmailer/class.smtp.php similarity index 90% rename from libraries/phpmailer/smtp.php rename to libraries/vendor/phpmailer/phpmailer/class.smtp.php index 9ffdac4eed07a..ec75ca547bd44 100644 --- a/libraries/phpmailer/smtp.php +++ b/libraries/vendor/phpmailer/phpmailer/class.smtp.php @@ -40,13 +40,13 @@ class SMTP /** * The SMTP port to use if one is not specified. - * @type integer + * @type int */ const DEFAULT_SMTP_PORT = 25; /** * The maximum line length allowed by RFC 2822 section 2.1.1 - * @type integer + * @type int */ const MAX_LINE_LENGTH = 998; @@ -60,7 +60,7 @@ class SMTP /** * SMTP server port number. - * @type integer + * @type int * @deprecated This is only ever used as a default value, so use the constant instead * @see SMTP::DEFAULT_SMTP_PORT */ @@ -82,7 +82,7 @@ class SMTP * * `2` Data and commands * * `3` As 2 plus connection status * * `4` Low-level data output - * @type integer + * @type int */ public $do_debug = 0; @@ -100,7 +100,7 @@ class SMTP * Whether to use VERP. * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path * @link http://www.postfix.org/VERP_README.html Info on VERP - * @type boolean + * @type bool */ public $do_verp = false; @@ -109,13 +109,13 @@ class SMTP * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2 - * @type integer + * @type int */ public $Timeout = 300; /** * The SMTP timelimit value for reads, in seconds. - * @type integer + * @type int */ public $Timelimit = 30; @@ -127,16 +127,15 @@ class SMTP /** * Error message, if any, for the last call. - * @type array + * @type string */ - protected $error = array(); + protected $error = ''; /** * The reply the server sent to us for HELO. - * If null, no HELO string has yet been received. - * @type string|null + * @type string */ - protected $helo_rply = null; + protected $helo_rply = ''; /** * The most recent reply received from the server. @@ -144,6 +143,18 @@ class SMTP */ protected $last_reply = ''; + /** + * Constructor. + * @access public + */ + public function __construct() + { + $this->smtp_conn = 0; + $this->error = null; + $this->helo_rply = null; + $this->do_debug = 0; + } + /** * Output debugging info via a user-selected method. * @param string $str Debug string to output @@ -174,22 +185,16 @@ protected function edebug($str) /** * Connect to an SMTP server. * @param string $host SMTP server IP or host name - * @param integer $port The port number to connect to - * @param integer $timeout How long to wait for the connection to open + * @param int $port The port number to connect to + * @param int $timeout How long to wait for the connection to open * @param array $options An array of options for stream_context_create() * @access public - * @return boolean + * @return bool */ public function connect($host, $port = null, $timeout = 30, $options = array()) { - static $streamok; - //This is enabled by default since 5.0.0 but some providers disable it - //Check this once and cache the result - if (is_null($streamok)) { - $streamok = function_exists('stream_socket_client'); - } // Clear errors to avoid confusion - $this->error = array(); + $this->error = null; // Make sure we are __not__ connected if ($this->connected()) { // Already connected, generate error @@ -201,36 +206,22 @@ public function connect($host, $port = null, $timeout = 30, $options = array()) } // Connect to the SMTP server if ($this->do_debug >= 3) { - $this->edebug("Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true)); + $this->edebug('Connection: opening'); } $errno = 0; $errstr = ''; - if ($streamok) { - $socket_context = stream_context_create($options); - //Suppress errors; connection failures are handled at a higher level - $this->smtp_conn = @stream_socket_client( - $host . ":" . $port, - $errno, - $errstr, - $timeout, - STREAM_CLIENT_CONNECT, - $socket_context - ); - } else { - //Fall back to fsockopen which should work in more places, but is missing some features - if ($this->do_debug >= 3) { - $this->edebug("Connection: stream_socket_client not available, falling back to fsockopen"); - } - $this->smtp_conn = fsockopen( - $host, - $port, - $errno, - $errstr, - $timeout - ); - } + $socket_context = stream_context_create($options); + //Suppress errors; connection failures are handled at a higher level + $this->smtp_conn = @stream_socket_client( + $host . ":" . $port, + $errno, + $errstr, + $timeout, + STREAM_CLIENT_CONNECT, + $socket_context + ); // Verify we connected properly - if (!is_resource($this->smtp_conn)) { + if (empty($this->smtp_conn)) { $this->error = array( 'error' => 'Failed to connect to server', 'errno' => $errno, @@ -267,7 +258,7 @@ public function connect($host, $port = null, $timeout = 30, $options = array()) /** * Initiate a TLS (encrypted) session. * @access public - * @return boolean + * @return bool */ public function startTLS() { @@ -295,7 +286,7 @@ public function startTLS() * @param string $realm The auth realm for NTLM * @param string $workstation The auth workstation for NTLM * @access public - * @return boolean True if successfully authenticated. + * @return bool True if successfully authenticated. */ public function authenticate( $username, @@ -386,6 +377,7 @@ public function authenticate( ); // send encoded username return $this->sendCommand('Username', base64_encode($msg3), 235); + break; case 'CRAM-MD5': // Start authentication if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { @@ -399,6 +391,7 @@ public function authenticate( // send encoded credentials return $this->sendCommand('Username', base64_encode($response), 235); + break; } return true; } @@ -442,11 +435,11 @@ protected function hmac($data, $key) /** * Check connection state. * @access public - * @return boolean True if connected. + * @return bool True if connected. */ public function connected() { - if (is_resource($this->smtp_conn)) { + if (!empty($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status['eof']) { // the socket is valid but we are not connected @@ -472,14 +465,15 @@ public function connected() */ public function close() { - $this->error = array(); + $this->error = null; // so there is no confusion $this->helo_rply = null; - if (is_resource($this->smtp_conn)) { + if (!empty($this->smtp_conn)) { // close the connection and cleanup fclose($this->smtp_conn); if ($this->do_debug >= 3) { $this->edebug('Connection: closed'); } + $this->smtp_conn = 0; } } @@ -493,7 +487,7 @@ public function close() * Implements rfc 821: DATA
", with no corresponding closing tag. * - * Tags should be in the form "
", with no corresponding closing tag. - * @param string $allowed_tags + * @access public + * @return void */ - public function set_allowed_tags($allowed_tags = '') + public function set_allowed_tags( $allowed_tags = '' ) { - if (!empty($allowed_tags)) { + if ( !empty($allowed_tags) ) { $this->allowed_tags = $allowed_tags; } } /** - * Sets a base URL to handle relative links. + * Sets a base URL to handle relative links. * - * @param string $url + * @access public + * @return void */ - public function set_base_url($url = '') + public function set_base_url( $url = '' ) { - if (empty($url)) { - if (!empty($_SERVER['HTTP_HOST'])) { + if ( empty($url) ) { + if ( !empty($_SERVER['HTTP_HOST']) ) { $this->url = 'http://' . $_SERVER['HTTP_HOST']; } else { $this->url = ''; @@ -360,7 +379,7 @@ public function set_base_url($url = '') } else { // Strip any trailing slashes for consistency (relative // URLs may already start with a slash like "/file.html") - if (substr($url, -1) == '/') { + if ( substr($url, -1) == '/' ) { $url = substr($url, 0, -1); } $this->url = $url; @@ -368,9 +387,12 @@ public function set_base_url($url = '') } /** - * Workhorse function that does actual conversion (calls _converter() method). + * Workhorse function that does actual conversion (calls _converter() method). + * + * @access private + * @return void */ - protected function _convert() + private function _convert() { // Variables used for building the link list $this->_link_list = array(); @@ -384,7 +406,7 @@ protected function _convert() if (!empty($this->_link_list)) { $text .= "\n\nLinks:\n------\n"; foreach ($this->_link_list as $idx => $url) { - $text .= '[' . ($idx + 1) . '] ' . $url . "\n"; + $text .= '[' . ($idx+1) . '] ' . $url . "\n"; } } @@ -394,16 +416,19 @@ protected function _convert() } /** - * Workhorse function that does actual conversion. + * Workhorse function that does actual conversion. + * + * First performs custom tag replacement specified by $search and + * $replace arrays. Then strips any remaining HTML tags, reduces whitespace + * and newlines to a readable format, and word wraps the text to + * $this->_options['width'] characters. * - * First performs custom tag replacement specified by $search and - * $replace arrays. Then strips any remaining HTML tags, reduces whitespace - * and newlines to a readable format, and word wraps the text to - * $this->_options['width'] characters. + * @param string Reference to HTML content string * - * @param string $text Reference to HTML content string + * @access private + * @return void */ - protected function _converter(&$text) + private function _converter(&$text) { // Convert
(before PRE!) $this->_convert_blockquotes($text); @@ -443,40 +468,39 @@ protected function _converter(&$text) // Wrap the text to a readable format // for PHP versions >= 4.0.2. Default width is 75 // If width is 0 or less, don't wrap the text. - if ($this->_options['width'] > 0) { + if ( $this->_options['width'] > 0 ) { $text = wordwrap($text, $this->_options['width']); } } /** - * Helper function called by preg_replace() on link replacement. + * Helper function called by preg_replace() on link replacement. * - * Maintains an internal list of links to be displayed at the end of the - * text, with numeric indices to the original point in the text they - * appeared. Also makes an effort at identifying and handling absolute - * and relative links. + * Maintains an internal list of links to be displayed at the end of the + * text, with numeric indices to the original point in the text they + * appeared. Also makes an effort at identifying and handling absolute + * and relative links. * - * @param string $link URL of the link - * @param string $display Part of the text to associate number with - * @param null $link_override - * @return string + * @param string $link URL of the link + * @param string $display Part of the text to associate number with + * @access private + * @return string */ - protected function _build_link_list($link, $display, $link_override = null) + private function _build_link_list( $link, $display, $link_override = null) { $link_method = ($link_override) ? $link_override : $this->_options['do_links']; - if ($link_method == 'none') { + if ($link_method == 'none') return $display; - } // Ignored link types if (preg_match('!^(javascript:|mailto:|#)!i', $link)) { return $display; } - if (preg_match('!^([a-z][a-z0-9.+-]+:)!i', $link)) { $url = $link; - } else { + } + else { $url = $this->url; if (substr($link, 0, 1) != '/') { $url .= '/'; @@ -484,52 +508,47 @@ protected function _build_link_list($link, $display, $link_override = null) $url .= "$link"; } - if ($link_method == 'table') { + if ($link_method == 'table') + { if (($index = array_search($url, $this->_link_list)) === false) { $index = count($this->_link_list); $this->_link_list[] = $url; } - return $display . ' [' . ($index + 1) . ']'; - } elseif ($link_method == 'nextline') { + return $display . ' [' . ($index+1) . ']'; + } + elseif ($link_method == 'nextline') + { return $display . "\n[" . $url . ']'; - } else { // link_method defaults to inline - + } + else // link_method defaults to inline + { return $display . ' [' . $url . ']'; } } /** - * Helper function for PRE body conversion. + * Helper function for PRE body conversion. * - * @param string $text HTML content + * @param string HTML content + * @access private */ - protected function _convert_pre(&$text) + private function _convert_pre(&$text) { // get the content of PRE element while (preg_match('/]*>(.*)<\/pre>/ismU', $text, $matches)) { $this->pre_content = $matches[1]; // Run our defined tags search-and-replace with callback - $this->pre_content = preg_replace_callback( - $this->callback_search, - array($this, '_preg_callback'), - $this->pre_content - ); + $this->pre_content = preg_replace_callback($this->callback_search, + array($this, '_preg_callback'), $this->pre_content); // convert the content - $this->pre_content = sprintf( - '', - preg_replace($this->pre_search, $this->pre_replace, $this->pre_content) - ); - + $this->pre_content = sprintf('
%s', + preg_replace($this->pre_search, $this->pre_replace, $this->pre_content)); // replace the content (use callback because content can contain $0 variable) - $text = preg_replace_callback( - '/
%s]*>.*<\/pre>/ismU', - array($this, '_preg_pre_callback'), - $text, - 1 - ); + $text = preg_replace_callback('/]*>.*<\/pre>/ismU', + array($this, '_preg_pre_callback'), $text, 1); // free memory $this->pre_content = ''; @@ -537,27 +556,30 @@ protected function _convert_pre(&$text) } /** - * Helper function for BLOCKQUOTE body conversion. + * Helper function for BLOCKQUOTE body conversion. * - * @param string $text HTML content + * @param string HTML content + * @access private */ - protected function _convert_blockquotes(&$text) + private function _convert_blockquotes(&$text) { if (preg_match_all('/<\/*blockquote[^>]*>/i', $text, $matches, PREG_OFFSET_CAPTURE)) { - $start = 0; - $taglen = 0; $level = 0; $diff = 0; + $start = 0; + $taglen = 0; foreach ($matches[0] as $m) { if ($m[0][0] == '<' && $m[0][1] == '/') { $level--; if ($level < 0) { $level = 0; // malformed HTML: go to next blockquote - } elseif ($level > 0) { + } + else if ($level > 0) { // skip inner blockquote - } else { - $end = $m[1]; - $len = $end - $taglen - $start; + } + else { + $end = $m[1]; + $len = $end - $taglen - $start; // Get blockquote content $body = substr($text, $start + $taglen - $diff, $len); @@ -579,56 +601,54 @@ protected function _convert_blockquotes(&$text) $diff = $len + $taglen + strlen($m[0]) - strlen($body); unset($body); } - } else { + } + else { if ($level == 0) { $start = $m[1]; $taglen = strlen($m[0]); } - $level++; + $level ++; } } } } /** - * Callback function for preg_replace_callback use. + * Callback function for preg_replace_callback use. * - * @param array $matches PREG matches - * @return string + * @param array PREG matches + * @return string */ - protected function _preg_callback($matches) + private function _preg_callback($matches) { switch (strtolower($matches[1])) { case 'b': case 'strong': return $this->_toupper($matches[3]); case 'th': - return $this->_toupper("\t\t" . $matches[3] . "\n"); + return $this->_toupper("\t\t". $matches[3] ."\n"); case 'h': - return $this->_toupper("\n\n" . $matches[3] . "\n\n"); + return $this->_toupper("\n\n". $matches[3] ."\n\n"); case 'a': // override the link method $link_override = null; - if (preg_match('/_html2text_link_(\w+)/', $matches[4], $link_override_match)) { + if (preg_match("/_html2text_link_(\w+)/", $matches[4], $link_override_match)) + { $link_override = $link_override_match[1]; } // Remove spaces in URL (#1487805) $url = str_replace(' ', '', $matches[3]); - return $this->_build_link_list($url, $matches[5], $link_override); } - return ''; } /** - * Callback function for preg_replace_callback use in PRE content handler. + * Callback function for preg_replace_callback use in PRE content handler. * - * @param array $matches PREG matches - * @return string + * @param array PREG matches + * @return string */ - protected function _preg_pre_callback( - /** @noinspection PhpUnusedParameterInspection */ - $matches) + private function _preg_pre_callback($matches) { return $this->pre_content; } @@ -641,7 +661,7 @@ protected function _preg_pre_callback( */ private function _toupper($str) { - // string can contain HTML tags + // string can containg HTML tags $chunks = preg_split('/(<[^>]*>)/', $str, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); // convert toupper only the text between HTML tags @@ -656,7 +676,6 @@ private function _toupper($str) /** * Strtoupper multibyte wrapper function with HTML entities handling. - * Forces mb_strtoupper-call to UTF-8. * * @param string $str Text to convert * @return string Converted text @@ -666,7 +685,7 @@ private function _strtoupper($str) $str = html_entity_decode($str, ENT_COMPAT); if (function_exists('mb_strtoupper')) - $str = mb_strtoupper($str, 'UTF-8'); + $str = mb_strtoupper($str); else $str = strtoupper($str); @@ -674,4 +693,4 @@ private function _strtoupper($str) return $str; } -} +} \ No newline at end of file diff --git a/libraries/phpmailer/extras/htmlfilter.php b/libraries/vendor/phpmailer/phpmailer/extras/htmlfilter.php similarity index 97% rename from libraries/phpmailer/extras/htmlfilter.php rename to libraries/vendor/phpmailer/phpmailer/extras/htmlfilter.php index e91b3147af1b4..0c01eaa17c95b 100644 --- a/libraries/phpmailer/extras/htmlfilter.php +++ b/libraries/vendor/phpmailer/phpmailer/extras/htmlfilter.php @@ -34,7 +34,7 @@ * * @param string $tagname the name of the tag. * @param array $attary the array of attributes and their values - * @param integer $tagtype The type of the tag (see in comments). + * @param int $tagtype The type of the tag (see in comments). * @return string A string with the final tag representation. */ function tln_tagprint($tagname, $attary, $tagtype) @@ -75,9 +75,9 @@ function tln_casenormalize(&$val) * a string and to the next non-whitespace value. * * @param string $body the string - * @param integer $offset the offset within the string where we should start + * @param int $offset the offset within the string where we should start * looking for the next non-whitespace character. - * @return integer the location within the $body where the next + * @return int the location within the $body where the next * non-whitespace char is located. */ function tln_skipspace($body, $offset) @@ -96,9 +96,9 @@ function tln_skipspace($body, $offset) * nicely. * * @param string $body The string to look for needle in. - * @param integer $offset Start looking from this position. + * @param int $offset Start looking from this position. * @param string $needle The character/string to look for. - * @return integer location of the next occurrence of the needle, or + * @return int location of the next occurrence of the needle, or * strlen($body) if needle wasn't found. */ function tln_findnxstr($body, $offset, $needle) @@ -115,7 +115,7 @@ function tln_findnxstr($body, $offset, $needle) * within the string. * * @param string $body The string to look for needle in. - * @param integer $offset Start looking from here. + * @param int $offset Start looking from here. * @param string $reg A PCRE-style regex to match. * @return array|boolean Returns a false if no matches found, or an array * with the following members: @@ -143,7 +143,7 @@ function tln_findnxreg($body, $offset, $reg) * This function looks for the next tag. * * @param string $body String where to look for the next tag. - * @param integer $offset Start looking from here. + * @param int $offset Start looking from here. * @return array|boolean false if no more tags exist in the body, or * an array with the following members: * - string with the name of the tag @@ -436,8 +436,8 @@ function tln_getnxtag($body, $offset) * * @param string $attvalue the by-ref value to check. * @param string $regex the regular expression to check against. - * @param boolean $hex whether the entites are hexadecimal. - * @return boolean True or False depending on whether there were matches. + * @param bool $hex whether the entites are hexadecimal. + * @return bool True or False depending on whether there were matches. */ function tln_deent(&$attvalue, $regex, $hex = false) { @@ -583,7 +583,7 @@ function tln_fixatts( * @param array $tag_list see description above * @param array $rm_tags_with_content see description above * @param array $self_closing_tags see description above - * @param boolean $force_tag_closing see description above + * @param bool $force_tag_closing see description above * @param array $rm_attnames see description above * @param array $bad_attvals see description above * @param array $add_attr_to_tag see description above diff --git a/libraries/phpmailer/extras/ntlm_sasl_client.php b/libraries/vendor/phpmailer/phpmailer/extras/ntlm_sasl_client.php similarity index 99% rename from libraries/phpmailer/extras/ntlm_sasl_client.php rename to libraries/vendor/phpmailer/phpmailer/extras/ntlm_sasl_client.php index 7559aa1d735b5..b21ccce0e40a0 100644 --- a/libraries/phpmailer/extras/ntlm_sasl_client.php +++ b/libraries/vendor/phpmailer/phpmailer/extras/ntlm_sasl_client.php @@ -182,4 +182,4 @@ class ntlm_sasl_client_class } }; -?> +?> \ No newline at end of file diff --git a/libraries/vendor/psr/log/LICENSE b/libraries/vendor/psr/log/LICENSE new file mode 100644 index 0000000000000..474c952b4b50c --- /dev/null +++ b/libraries/vendor/psr/log/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/libraries/vendor/psr/log/Psr/Log/AbstractLogger.php b/libraries/vendor/psr/log/Psr/Log/AbstractLogger.php new file mode 100644 index 0000000000000..00f9034521b42 --- /dev/null +++ b/libraries/vendor/psr/log/Psr/Log/AbstractLogger.php @@ -0,0 +1,120 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * @return null + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * @return null + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * @return null + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * @return null + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * @return null + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * @return null + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * @return null + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } +} diff --git a/libraries/vendor/psr/log/Psr/Log/InvalidArgumentException.php b/libraries/vendor/psr/log/Psr/Log/InvalidArgumentException.php new file mode 100644 index 0000000000000..67f852d1dbc66 --- /dev/null +++ b/libraries/vendor/psr/log/Psr/Log/InvalidArgumentException.php @@ -0,0 +1,7 @@ +logger = $logger; + } +} diff --git a/libraries/vendor/psr/log/Psr/Log/LoggerInterface.php b/libraries/vendor/psr/log/Psr/Log/LoggerInterface.php new file mode 100644 index 0000000000000..476bb962af788 --- /dev/null +++ b/libraries/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -0,0 +1,114 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * @return null + */ + public function alert($message, array $context = array()) + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * @return null + */ + public function critical($message, array $context = array()) + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * @return null + */ + public function error($message, array $context = array()) + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * @return null + */ + public function warning($message, array $context = array()) + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * @return null + */ + public function notice($message, array $context = array()) + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * @return null + */ + public function info($message, array $context = array()) + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * @return null + */ + public function debug($message, array $context = array()) + { + $this->log(LogLevel::DEBUG, $message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * @return null + */ + abstract public function log($level, $message, array $context = array()); +} diff --git a/libraries/vendor/psr/log/Psr/Log/NullLogger.php b/libraries/vendor/psr/log/Psr/Log/NullLogger.php new file mode 100644 index 0000000000000..553a3c593ae5f --- /dev/null +++ b/libraries/vendor/psr/log/Psr/Log/NullLogger.php @@ -0,0 +1,27 @@ +logger) { }` + * blocks. + */ +class NullLogger extends AbstractLogger +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * @return null + */ + public function log($level, $message, array $context = array()) + { + // noop + } +} diff --git a/libraries/framework/Symfony/Component/Yaml/Dumper.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php similarity index 86% rename from libraries/framework/Symfony/Component/Yaml/Dumper.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php index 8709f8b7e4628..26103c88ece9f 100644 --- a/libraries/framework/Symfony/Component/Yaml/Dumper.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php @@ -21,14 +21,14 @@ class Dumper /** * The amount of spaces to use for indentation of nested nodes. * - * @var integer + * @var int */ protected $indentation = 4; /** * Sets the indentation. * - * @param integer $num The amount of spaces to use for indentation of nested nodes. + * @param int $num The amount of spaces to use for indentation of nested nodes. */ public function setIndentation($num) { @@ -39,10 +39,10 @@ public function setIndentation($num) * Dumps a PHP value to YAML. * * @param mixed $input The PHP value - * @param integer $inline The level where you switch to inline YAML - * @param integer $indent The level of indentation (used internally) - * @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param Boolean $objectSupport true if object support is enabled, false otherwise + * @param int $inline The level where you switch to inline YAML + * @param int $indent The level of indentation (used internally) + * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise + * @param bool $objectSupport true if object support is enabled, false otherwise * * @return string The YAML representation of the PHP value */ diff --git a/libraries/framework/Symfony/Component/Yaml/Escaper.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php similarity index 89% rename from libraries/framework/Symfony/Component/Yaml/Escaper.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php index 3576e9ae6faa4..7f6ec2bef297d 100644 --- a/libraries/framework/Symfony/Component/Yaml/Escaper.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php @@ -26,25 +26,25 @@ class Escaper // first to ensure proper escaping because str_replace operates iteratively // on the input arrays. This ordering of the characters avoids the use of strtr, // which performs more slowly. - private static $escapees = array('\\\\', '\\"', '"', + private static $escapees = array('\\', '\\\\', '\\"', '"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); - private static $escaped = array('\\"', '\\\\', '\\"', + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",); + private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', "\\0", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\x0e", "\\x0f", "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", "\\x18", "\\x19", "\\x1a", "\\e", "\\x1c", "\\x1d", "\\x1e", "\\x1f", - "\\N", "\\_", "\\L", "\\P"); + "\\N", "\\_", "\\L", "\\P",); /** * Determines if a PHP value would require double quoting in YAML. * * @param string $value A PHP value * - * @return Boolean True if the value would require double quotes. + * @return bool True if the value would require double quotes. */ public static function requiresDoubleQuoting($value) { @@ -68,7 +68,7 @@ public static function escapeWithDoubleQuotes($value) * * @param string $value A PHP value * - * @return Boolean True if the value would require single quotes. + * @return bool True if the value would require single quotes. */ public static function requiresSingleQuoting($value) { diff --git a/libraries/framework/Symfony/Component/Yaml/Exception/DumpException.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/DumpException.php similarity index 100% rename from libraries/framework/Symfony/Component/Yaml/Exception/DumpException.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/DumpException.php diff --git a/libraries/framework/Symfony/Component/Yaml/Exception/ExceptionInterface.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ExceptionInterface.php similarity index 100% rename from libraries/framework/Symfony/Component/Yaml/Exception/ExceptionInterface.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ExceptionInterface.php diff --git a/libraries/framework/Symfony/Component/Yaml/Exception/ParseException.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php similarity index 94% rename from libraries/framework/Symfony/Component/Yaml/Exception/ParseException.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php index 938097b8b3e59..ff01d6b9a69cc 100644 --- a/libraries/framework/Symfony/Component/Yaml/Exception/ParseException.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php @@ -34,8 +34,8 @@ class ParseException extends RuntimeException * Constructor. * * @param string $message The error message - * @param integer $parsedLine The line where the error occurred - * @param integer $snippet The snippet of code near the problem + * @param int $parsedLine The line where the error occurred + * @param int $snippet The snippet of code near the problem * @param string $parsedFile The file name where the error occurred * @param \Exception $previous The previous exception */ @@ -100,7 +100,7 @@ public function setParsedFile($parsedFile) /** * Gets the line where the error occurred. * - * @return integer The file line + * @return int The file line */ public function getParsedLine() { @@ -110,7 +110,7 @@ public function getParsedLine() /** * Sets the line where the error occurred. * - * @param integer $parsedLine The file line + * @param int $parsedLine The file line */ public function setParsedLine($parsedLine) { diff --git a/libraries/framework/Symfony/Component/Yaml/Exception/RuntimeException.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/RuntimeException.php similarity index 100% rename from libraries/framework/Symfony/Component/Yaml/Exception/RuntimeException.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/RuntimeException.php diff --git a/libraries/framework/Symfony/Component/Yaml/Inline.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php similarity index 66% rename from libraries/framework/Symfony/Component/Yaml/Inline.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php index 45efced3c89ac..8fec216dde139 100644 --- a/libraries/framework/Symfony/Component/Yaml/Inline.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php @@ -30,14 +30,15 @@ class Inline * Converts a YAML string to a PHP array. * * @param string $value A YAML string - * @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param Boolean $objectSupport true if object support is enabled, false otherwise + * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise + * @param bool $objectSupport true if object support is enabled, false otherwise + * @param array $references Mapping of variable names to values * * @return array A PHP array representing the YAML string * * @throws ParseException */ - public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false) + public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $references = array()) { self::$exceptionOnInvalidType = $exceptionOnInvalidType; self::$objectSupport = $objectSupport; @@ -56,15 +57,15 @@ public static function parse($value, $exceptionOnInvalidType = false, $objectSup $i = 0; switch ($value[0]) { case '[': - $result = self::parseSequence($value, $i); + $result = self::parseSequence($value, $i, $references); ++$i; break; case '{': - $result = self::parseMapping($value, $i); + $result = self::parseMapping($value, $i, $references); ++$i; break; default: - $result = self::parseScalar($value, null, array('"', "'"), $i); + $result = self::parseScalar($value, null, array('"', "'"), $i, true, $references); } // some comments are allowed at the end @@ -83,8 +84,8 @@ public static function parse($value, $exceptionOnInvalidType = false, $objectSup * Dumps a given PHP variable to a YAML string. * * @param mixed $value The PHP variable to convert - * @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param Boolean $objectSupport true if object support is enabled, false otherwise + * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise + * @param bool $objectSupport true if object support is enabled, false otherwise * * @return string The YAML string representing the PHP array * @@ -149,8 +150,8 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp * Dumps a PHP array to a YAML string. * * @param array $value The PHP array to dump - * @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param Boolean $objectSupport true if object support is enabled, false otherwise + * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise + * @param bool $objectSupport true if object support is enabled, false otherwise * * @return string The YAML string representing the PHP array */ @@ -159,7 +160,7 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor // array $keys = array_keys($value); if ((1 == count($keys) && '0' == $keys[0]) - || (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (integer) $v + $w; }, 0) == count($keys) * (count($keys) - 1) / 2) + || (count($keys) > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) == count($keys) * (count($keys) - 1) / 2) ) { $output = array(); foreach ($value as $val) { @@ -184,14 +185,15 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor * @param scalar $scalar * @param string $delimiters * @param array $stringDelimiters - * @param integer &$i - * @param Boolean $evaluate + * @param int &$i + * @param bool $evaluate + * @param array $references * * @return string A YAML string * * @throws ParseException When malformed inline YAML string is parsed */ - public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) + public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true, $references = array()) { if (in_array($scalar[$i], $stringDelimiters)) { // quoted scalar @@ -220,7 +222,9 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar)); } - $output = $evaluate ? self::evaluateScalar($output) : $output; + if ($evaluate) { + $output = self::evaluateScalar($output, $references); + } } return $output; @@ -230,7 +234,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter * Parses a quoted scalar to YAML. * * @param string $scalar - * @param integer &$i + * @param int &$i * * @return string A YAML string * @@ -260,13 +264,14 @@ private static function parseQuotedScalar($scalar, &$i) * Parses a sequence to a YAML string. * * @param string $sequence - * @param integer &$i + * @param int &$i + * @param array $references * * @return string A YAML string * * @throws ParseException When malformed inline YAML string is parsed */ - private static function parseSequence($sequence, &$i = 0) + private static function parseSequence($sequence, &$i = 0, $references = array()) { $output = array(); $len = strlen($sequence); @@ -277,11 +282,11 @@ private static function parseSequence($sequence, &$i = 0) switch ($sequence[$i]) { case '[': // nested sequence - $output[] = self::parseSequence($sequence, $i); + $output[] = self::parseSequence($sequence, $i, $references); break; case '{': // nested mapping - $output[] = self::parseMapping($sequence, $i); + $output[] = self::parseMapping($sequence, $i, $references); break; case ']': return $output; @@ -290,12 +295,14 @@ private static function parseSequence($sequence, &$i = 0) break; default: $isQuoted = in_array($sequence[$i], array('"', "'")); - $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i); + $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i, true, $references); - if (!$isQuoted && false !== strpos($value, ': ')) { + // the value can be an array if a reference has been resolved to an array var + if (!is_array($value) && !$isQuoted && false !== strpos($value, ': ')) { // embedded mapping? try { - $value = self::parseMapping('{'.$value.'}'); + $pos = 0; + $value = self::parseMapping('{'.$value.'}', $pos, $references); } catch (\InvalidArgumentException $e) { // no, it's not } @@ -316,13 +323,14 @@ private static function parseSequence($sequence, &$i = 0) * Parses a mapping to a YAML string. * * @param string $mapping - * @param integer &$i + * @param int &$i + * @param array $references * * @return string A YAML string * * @throws ParseException When malformed inline YAML string is parsed */ - private static function parseMapping($mapping, &$i = 0) + private static function parseMapping($mapping, &$i = 0, $references = array()) { $output = array(); $len = strlen($mapping); @@ -348,19 +356,37 @@ private static function parseMapping($mapping, &$i = 0) switch ($mapping[$i]) { case '[': // nested sequence - $output[$key] = self::parseSequence($mapping, $i); + $value = self::parseSequence($mapping, $i, $references); + // Spec: Keys MUST be unique; first one wins. + // Parser cannot abort this mapping earlier, since lines + // are processed sequentially. + if (!isset($output[$key])) { + $output[$key] = $value; + } $done = true; break; case '{': // nested mapping - $output[$key] = self::parseMapping($mapping, $i); + $value = self::parseMapping($mapping, $i, $references); + // Spec: Keys MUST be unique; first one wins. + // Parser cannot abort this mapping earlier, since lines + // are processed sequentially. + if (!isset($output[$key])) { + $output[$key] = $value; + } $done = true; break; case ':': case ' ': break; default: - $output[$key] = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i); + $value = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i, true, $references); + // Spec: Keys MUST be unique; first one wins. + // Parser cannot abort this mapping earlier, since lines + // are processed sequentially. + if (!isset($output[$key])) { + $output[$key] = $value; + } $done = true; --$i; } @@ -380,57 +406,84 @@ private static function parseMapping($mapping, &$i = 0) * Evaluates scalars and replaces magic values. * * @param string $scalar + * @param array $references * * @return string A YAML string + * + * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved */ - private static function evaluateScalar($scalar) + private static function evaluateScalar($scalar, $references = array()) { $scalar = trim($scalar); + $scalarLower = strtolower($scalar); - switch (true) { - case 'null' == strtolower($scalar): - case '' == $scalar: - case '~' == $scalar: - return null; - case 0 === strpos($scalar, '!str'): - return (string) substr($scalar, 5); - case 0 === strpos($scalar, '! '): - return intval(self::parseScalar(substr($scalar, 2))); - case 0 === strpos($scalar, '!!php/object:'): - if (self::$objectSupport) { - return unserialize(substr($scalar, 13)); - } + if (0 === strpos($scalar, '*')) { + if (false !== $pos = strpos($scalar, '#')) { + $value = substr($scalar, 1, $pos - 2); + } else { + $value = substr($scalar, 1); + } - if (self::$exceptionOnInvalidType) { - throw new ParseException('Object support when parsing a YAML file has been disabled.'); - } + // an unquoted * + if (false === $value || '' === $value) { + throw new ParseException('A reference must contain at least one character.'); + } - return null; - case ctype_digit($scalar): - $raw = $scalar; - $cast = intval($scalar); + if (!array_key_exists($value, $references)) { + throw new ParseException(sprintf('Reference "%s" does not exist.', $value)); + } - return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); - case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): - $raw = $scalar; - $cast = intval($scalar); + return $references[$value]; + } - return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); - case 'true' === strtolower($scalar): + switch (true) { + case 'null' === $scalarLower: + case '' === $scalar: + case '~' === $scalar: + return; + case 'true' === $scalarLower: return true; - case 'false' === strtolower($scalar): + case 'false' === $scalarLower: return false; - case is_numeric($scalar): - return '0x' == $scalar[0].$scalar[1] ? hexdec($scalar) : floatval($scalar); - case 0 == strcasecmp($scalar, '.inf'): - case 0 == strcasecmp($scalar, '.NaN'): - return -log(0); - case 0 == strcasecmp($scalar, '-.inf'): - return log(0); - case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): - return floatval(str_replace(',', '', $scalar)); - case preg_match(self::getTimestampRegex(), $scalar): - return strtotime($scalar); + // Optimise for returning strings. + case $scalar[0] === '+' || $scalar[0] === '-' || $scalar[0] === '.' || $scalar[0] === '!' || is_numeric($scalar[0]): + switch (true) { + case 0 === strpos($scalar, '!str'): + return (string) substr($scalar, 5); + case 0 === strpos($scalar, '! '): + return intval(self::parseScalar(substr($scalar, 2))); + case 0 === strpos($scalar, '!!php/object:'): + if (self::$objectSupport) { + return unserialize(substr($scalar, 13)); + } + + if (self::$exceptionOnInvalidType) { + throw new ParseException('Object support when parsing a YAML file has been disabled.'); + } + + return; + case ctype_digit($scalar): + $raw = $scalar; + $cast = intval($scalar); + + return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); + case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): + $raw = $scalar; + $cast = intval($scalar); + + return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw); + case is_numeric($scalar): + return '0x' == $scalar[0].$scalar[1] ? hexdec($scalar) : floatval($scalar); + case '.inf' === $scalarLower: + case '.nan' === $scalarLower: + return -log(0); + case '-.inf' === $scalarLower: + return log(0); + case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): + return floatval(str_replace(',', '', $scalar)); + case preg_match(self::getTimestampRegex(), $scalar): + return strtotime($scalar); + } default: return (string) $scalar; } diff --git a/libraries/framework/Symfony/Component/Yaml/LICENSE b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE similarity index 96% rename from libraries/framework/Symfony/Component/Yaml/LICENSE rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE index 88a57f8d8da49..0b3292cf90235 100644 --- a/libraries/framework/Symfony/Component/Yaml/LICENSE +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2013 Fabien Potencier +Copyright (c) 2004-2014 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/libraries/framework/Symfony/Component/Yaml/Parser.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php similarity index 77% rename from libraries/framework/Symfony/Component/Yaml/Parser.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php index e8fe91848ebbd..fd9afafe36b4d 100644 --- a/libraries/framework/Symfony/Component/Yaml/Parser.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php @@ -31,7 +31,7 @@ class Parser /** * Constructor * - * @param integer $offset The offset of YAML document (used for line numbers in error messages) + * @param int $offset The offset of YAML document (used for line numbers in error messages) */ public function __construct($offset = 0) { @@ -42,8 +42,8 @@ public function __construct($offset = 0) * Parses a YAML string to a PHP value. * * @param string $value A YAML string - * @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param Boolean $objectSupport true if object support is enabled, false otherwise + * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise + * @param bool $objectSupport true if object support is enabled, false otherwise * * @return mixed A PHP value * @@ -55,7 +55,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $this->currentLine = ''; $this->lines = explode("\n", $this->cleanup($value)); - if (function_exists('mb_detect_encoding') && false === mb_detect_encoding($value, 'UTF-8', true)) { + if (!preg_match('//u', $value)) { throw new ParseException('The YAML value does not appear to be valid UTF-8.'); } @@ -66,6 +66,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $data = array(); $context = null; + $allowOverwrite = false; while ($this->moveToNextLine()) { if ($this->isCurrentLineEmpty()) { continue; @@ -76,7 +77,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine); } - $isRef = $isInPlace = $isProcessed = false; + $isRef = $mergeNode = false; if (preg_match('#^\-((?P\s+)(?P .+?))?\s*$#u', $this->currentLine, $values)) { if ($context && 'mapping' == $context) { throw new ParseException('You cannot define a sequence item when in a mapping'); @@ -92,8 +93,8 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { $c = $this->getRealCurrentLineNb() + 1; $parser = new Parser($c); - $parser->refs =& $this->refs; - $data[] = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport); + $parser->refs = & $this->refs; + $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport); } else { if (isset($values['leadspaces']) && ' ' == $values['leadspaces'] @@ -102,7 +103,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = // this is a compact notation element, add to next block and parse $c = $this->getRealCurrentLineNb(); $parser = new Parser($c); - $parser->refs =& $this->refs; + $parser->refs = & $this->refs; $block = $values['value']; if ($this->isNextLineIndented()) { @@ -114,14 +115,14 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport); } } - } elseif (preg_match('#^(?P '.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P .+?))?\s*$#u', $this->currentLine, $values) && false === strpos($values['key'],' #')) { + } elseif (preg_match('#^(?P '.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P .+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'],' #') || in_array($values['key'][0], array('"', "'")))) { if ($context && 'sequence' == $context) { throw new ParseException('You cannot define a mapping item when in a sequence'); } $context = 'mapping'; // force correct settings - Inline::parse(null, $exceptionOnInvalidType, $objectSupport); + Inline::parse(null, $exceptionOnInvalidType, $objectSupport, $this->refs); try { $key = Inline::parseScalar($values['key']); } catch (ParseException $e) { @@ -132,10 +133,24 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } if ('<<' === $key) { + $mergeNode = true; + $allowOverwrite = true; if (isset($values['value']) && 0 === strpos($values['value'], '*')) { - $isInPlace = substr($values['value'], 1); - if (!array_key_exists($isInPlace, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $isInPlace), $this->getRealCurrentLineNb() + 1, $this->currentLine); + $refName = substr($values['value'], 1); + if (!array_key_exists($refName, $this->refs)) { + throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + $refValue = $this->refs[$refName]; + + if (!is_array($refValue)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + + foreach ($refValue as $key => $value) { + if (!isset($data[$key])) { + $data[$key] = $value; + } } } else { if (isset($values['value']) && $values['value'] !== '') { @@ -145,51 +160,71 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } $c = $this->getRealCurrentLineNb() + 1; $parser = new Parser($c); - $parser->refs =& $this->refs; + $parser->refs = & $this->refs; $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport); - $merged = array(); if (!is_array($parsed)) { throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } elseif (isset($parsed[0])) { - // Numeric array, merge individual elements - foreach (array_reverse($parsed) as $parsedItem) { + } + + if (isset($parsed[0])) { + // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes + // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier + // in the sequence override keys specified in later mapping nodes. + foreach ($parsed as $parsedItem) { if (!is_array($parsedItem)) { throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem); } - $merged = array_merge($parsedItem, $merged); + + foreach ($parsedItem as $key => $value) { + if (!isset($data[$key])) { + $data[$key] = $value; + } + } } } else { - // Associative array, merge - $merged = array_merge($merged, $parsed); + // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the + // current mapping, unless the key already exists in it. + foreach ($parsed as $key => $value) { + if (!isset($data[$key])) { + $data[$key] = $value; + } + } } - - $isProcessed = $merged; } } elseif (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P .*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; } - if ($isProcessed) { + if ($mergeNode) { // Merge keys - $data = $isProcessed; - // hash } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { + // hash // if next line is less indented or equal, then it means that the current value is null if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { - $data[$key] = null; + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + $data[$key] = null; + } } else { $c = $this->getRealCurrentLineNb() + 1; $parser = new Parser($c); - $parser->refs =& $this->refs; - $data[$key] = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport); + $parser->refs = & $this->refs; + $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport); + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + $data[$key] = $value; + } } } else { - if ($isInPlace) { - $data = $this->refs[$isInPlace]; - } else { - $data[$key] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport); + $value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport); + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + $data[$key] = $value; } } } else { @@ -197,7 +232,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $lineCount = count($this->lines); if (1 === $lineCount || (2 === $lineCount && empty($this->lines[1]))) { try { - $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport); + $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $this->refs); } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); @@ -261,7 +296,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = /** * Returns the current line number (takes the offset into account). * - * @return integer The current line number + * @return int The current line number */ private function getRealCurrentLineNb() { @@ -271,7 +306,7 @@ private function getRealCurrentLineNb() /** * Returns the current line indentation. * - * @return integer The current line indentation + * @return int The current line indentation */ private function getCurrentLineIndentation() { @@ -281,15 +316,20 @@ private function getCurrentLineIndentation() /** * Returns the next embed block of YAML. * - * @param integer $indentation The indent level at which the block is to be read, or null for default + * @param int $indentation The indent level at which the block is to be read, or null for default + * @param bool $inSequence True if the enclosing data structure is a sequence * * @return string A YAML string * * @throws ParseException When indentation problem are detected */ - private function getNextEmbedBlock($indentation = null) + private function getNextEmbedBlock($indentation = null, $inSequence = false) { - $this->moveToNextLine(); + $oldLineIndentation = $this->getCurrentLineIndentation(); + + if (!$this->moveToNextLine()) { + return; + } if (null === $indentation) { $newIndent = $this->getCurrentLineIndentation(); @@ -305,6 +345,14 @@ private function getNextEmbedBlock($indentation = null) $data = array(substr($this->currentLine, $newIndent)); + if ($inSequence && $oldLineIndentation === $newIndent && '-' === $data[0][0]) { + // the previous line contained a dash but no item content, this line is a sequence item with the same indentation + // and therefore no nested list or mapping + $this->moveToPreviousLine(); + + return; + } + $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem($this->currentLine); // Comments must not be removed inside a string block (ie. after a line ending with "|") @@ -312,7 +360,9 @@ private function getNextEmbedBlock($indentation = null) $removeComments = !preg_match($removeCommentsPattern, $this->currentLine); while ($this->moveToNextLine()) { - if ($this->getCurrentLineIndentation() === $newIndent) { + $indent = $this->getCurrentLineIndentation(); + + if ($indent === $newIndent) { $removeComments = !preg_match($removeCommentsPattern, $this->currentLine); } @@ -321,20 +371,16 @@ private function getNextEmbedBlock($indentation = null) break; } - if ($removeComments && $this->isCurrentLineEmpty() || $this->isCurrentLineBlank()) { - if ($this->isCurrentLineBlank()) { - $data[] = substr($this->currentLine, $newIndent); - } - + if ($this->isCurrentLineBlank()) { + $data[] = substr($this->currentLine, $newIndent); continue; } - $indent = $this->getCurrentLineIndentation(); + if ($removeComments && $this->isCurrentLineComment()) { + continue; + } - if (preg_match('#^(?P *)$#', $this->currentLine, $match)) { - // empty line - $data[] = $match['text']; - } elseif ($indent >= $newIndent) { + if ($indent >= $newIndent) { $data[] = substr($this->currentLine, $newIndent); } elseif (0 == $indent) { $this->moveToPreviousLine(); @@ -351,7 +397,7 @@ private function getNextEmbedBlock($indentation = null) /** * Moves the parser to the next line. * - * @return Boolean + * @return bool */ private function moveToNextLine() { @@ -376,8 +422,8 @@ private function moveToPreviousLine() * Parses a YAML value. * * @param string $value A YAML value - * @param Boolean $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise - * @param Boolean $objectSupport True if object support is enabled, false otherwise + * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise + * @param bool $objectSupport True if object support is enabled, false otherwise * * @return mixed A PHP value * @@ -406,7 +452,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport) } try { - return Inline::parse($value, $exceptionOnInvalidType, $objectSupport); + return Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $this->refs); } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); @@ -420,7 +466,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport) * * @param string $separator The separator that was used to begin this folded scalar (| or >) * @param string $indicator The indicator that was used to begin this folded scalar (+ or -) - * @param integer $indentation The indentation that was used to begin this folded scalar + * @param int $indentation The indentation that was used to begin this folded scalar * * @return string The text value */ @@ -499,7 +545,7 @@ private function parseFoldedScalar($separator, $indicator = '', $indentation = 0 /** * Returns true if the next line is indented. * - * @return Boolean Returns true if the next line is indented, false otherwise + * @return bool Returns true if the next line is indented, false otherwise */ private function isNextLineIndented() { @@ -527,7 +573,7 @@ private function isNextLineIndented() /** * Returns true if the current line is blank or if it is a comment line. * - * @return Boolean Returns true if the current line is empty or if it is a comment line, false otherwise + * @return bool Returns true if the current line is empty or if it is a comment line, false otherwise */ private function isCurrentLineEmpty() { @@ -537,7 +583,7 @@ private function isCurrentLineEmpty() /** * Returns true if the current line is blank. * - * @return Boolean Returns true if the current line is blank, false otherwise + * @return bool Returns true if the current line is blank, false otherwise */ private function isCurrentLineBlank() { @@ -547,7 +593,7 @@ private function isCurrentLineBlank() /** * Returns true if the current line is a comment line. * - * @return Boolean Returns true if the current line is a comment line, false otherwise + * @return bool Returns true if the current line is a comment line, false otherwise */ private function isCurrentLineComment() { @@ -598,7 +644,7 @@ private function cleanup($value) /** * Returns true if the next line starts unindented collection * - * @return Boolean Returns true if the next line starts unindented collection, false otherwise + * @return bool Returns true if the next line starts unindented collection, false otherwise */ private function isNextLineUnIndentedCollection() { @@ -630,11 +676,10 @@ private function isNextLineUnIndentedCollection() /** * Returns true if the string is un-indented collection item * - * @return Boolean Returns true if the string is un-indented collection item, false otherwise + * @return bool Returns true if the string is un-indented collection item, false otherwise */ private function isStringUnIndentedCollectionItem() { return (0 === strpos($this->currentLine, '- ')); } - } diff --git a/libraries/framework/Symfony/Component/Yaml/Unescaper.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php similarity index 63% rename from libraries/framework/Symfony/Component/Yaml/Unescaper.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php index 1b8eeed57a94a..50b1018c404c1 100644 --- a/libraries/framework/Symfony/Component/Yaml/Unescaper.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php @@ -21,6 +21,7 @@ class Unescaper { // Parser and Inline assume UTF-8 encoding, so escaped Unicode characters // must be converted to that encoding. + // @deprecated since 2.5, to be removed in 3.0 const ENCODING = 'UTF-8'; // Regex fragment that matches an escaped character in a double quoted @@ -80,13 +81,13 @@ public function unescapeCharacter($value) case 'n': return "\n"; case 'v': - return "\xb"; + return "\xB"; case 'f': - return "\xc"; + return "\xC"; case 'r': - return "\xd"; + return "\r"; case 'e': - return "\x1b"; + return "\x1B"; case ' ': return ' '; case '"': @@ -97,50 +98,44 @@ public function unescapeCharacter($value) return '\\'; case 'N': // U+0085 NEXT LINE - return $this->convertEncoding("\x00\x85", self::ENCODING, 'UCS-2BE'); + return "\xC2\x85"; case '_': // U+00A0 NO-BREAK SPACE - return $this->convertEncoding("\x00\xA0", self::ENCODING, 'UCS-2BE'); + return "\xC2\xA0"; case 'L': // U+2028 LINE SEPARATOR - return $this->convertEncoding("\x20\x28", self::ENCODING, 'UCS-2BE'); + return "\xE2\x80\xA8"; case 'P': // U+2029 PARAGRAPH SEPARATOR - return $this->convertEncoding("\x20\x29", self::ENCODING, 'UCS-2BE'); + return "\xE2\x80\xA9"; case 'x': - $char = pack('n', hexdec(substr($value, 2, 2))); - - return $this->convertEncoding($char, self::ENCODING, 'UCS-2BE'); + return self::utf8chr(hexdec(substr($value, 2, 2))); case 'u': - $char = pack('n', hexdec(substr($value, 2, 4))); - - return $this->convertEncoding($char, self::ENCODING, 'UCS-2BE'); + return self::utf8chr(hexdec(substr($value, 2, 4))); case 'U': - $char = pack('N', hexdec(substr($value, 2, 8))); - - return $this->convertEncoding($char, self::ENCODING, 'UCS-4BE'); + return self::utf8chr(hexdec(substr($value, 2, 8))); } } /** - * Convert a string from one encoding to another. + * Get the UTF-8 character for the given code point. * - * @param string $value The string to convert - * @param string $to The input encoding - * @param string $from The output encoding + * @param int $c The unicode code point * - * @return string The string with the new encoding - * - * @throws \RuntimeException if no suitable encoding function is found (iconv or mbstring) + * @return string The corresponding UTF-8 character */ - private function convertEncoding($value, $to, $from) + private static function utf8chr($c) { - if (function_exists('mb_convert_encoding')) { - return mb_convert_encoding($value, $to, $from); - } elseif (function_exists('iconv')) { - return iconv($from, $to, $value); + if (0x80 > $c %= 0x200000) { + return chr($c); + } + if (0x800 > $c) { + return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F); + } + if (0x10000 > $c) { + return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); } - throw new \RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).'); + return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); } } diff --git a/libraries/framework/Symfony/Component/Yaml/Yaml.php b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php similarity index 88% rename from libraries/framework/Symfony/Component/Yaml/Yaml.php rename to libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php index c98f6ecdd96e7..61793fb3ae473 100644 --- a/libraries/framework/Symfony/Component/Yaml/Yaml.php +++ b/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php @@ -39,8 +39,8 @@ class Yaml * as an input is a deprecated feature and will be removed in 3.0. * * @param string $input Path to a YAML file or a string containing YAML - * @param Boolean $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise - * @param Boolean $objectSupport True if object support is enabled, false otherwise + * @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise + * @param bool $objectSupport True if object support is enabled, false otherwise * * @return array The YAML converted to a PHP array * @@ -81,10 +81,10 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup * to convert the array into friendly YAML. * * @param array $array PHP array - * @param integer $inline The level where you switch to inline YAML - * @param integer $indent The amount of spaces to use for indentation of nested nodes. - * @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise - * @param Boolean $objectSupport true if object support is enabled, false otherwise + * @param int $inline The level where you switch to inline YAML + * @param int $indent The amount of spaces to use for indentation of nested nodes. + * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise + * @param bool $objectSupport true if object support is enabled, false otherwise * * @return string A YAML string representing the original PHP array * diff --git a/tests/unit/suites/libraries/joomla/input/JInputCliTest.php b/tests/unit/suites/libraries/joomla/input/JInputCliTest.php index e95ed9b0af7ff..89d3936070340 100644 --- a/tests/unit/suites/libraries/joomla/input/JInputCliTest.php +++ b/tests/unit/suites/libraries/joomla/input/JInputCliTest.php @@ -43,7 +43,7 @@ protected function setUp() public function test_parseArguments($inputArgv, $expectedData, $expectedArgs) { $_SERVER['argv'] = $inputArgv; - $this->inspector = new JInputCLI(null, array('filter' => new JFilterInputMock)); + $this->inspector = new JInputCli(null, array('filter' => new JFilterInputMock)); $this->assertThat( TestReflection::getValue($this->inspector, 'data'), diff --git a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php b/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php index 01a5dc597aa5c..56f395d0362a8 100644 --- a/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php +++ b/tests/unit/suites/libraries/joomla/registry/format/JRegistryFormatIniTest.php @@ -25,7 +25,6 @@ class JRegistryFormatINITest extends PHPUnit_Framework_TestCase public function testObjectToString() { $class = JRegistryFormat::getInstance('INI'); - $options = null; $object = new stdClass; $object->foo = 'bar'; $object->booleantrue = true; @@ -36,7 +35,7 @@ public function testObjectToString() $object->section->key = 'value'; // Test basic object to string. - $string = $class->objectToString($object, $options); + $string = $class->objectToString($object); $this->assertThat( trim($string), $this->equalTo("foo=\"bar\"\nbooleantrue=true\nbooleanfalse=false\nnumericint=42\nnumericfloat=3.1415\n\n[section]\nkey=\"value\"") diff --git a/tests/unit/suites/libraries/joomla/string/JStringInflectorTest.php b/tests/unit/suites/libraries/joomla/string/JStringInflectorTest.php index 679c32adf23b8..d7687c9c7fe72 100644 --- a/tests/unit/suites/libraries/joomla/string/JStringInflectorTest.php +++ b/tests/unit/suites/libraries/joomla/string/JStringInflectorTest.php @@ -97,19 +97,18 @@ protected function setUp() } /** - * Method to test JStringInflector::_addRule(). + * Method to test JStringInflector::addRule(). * * @return void * * @since 12.1 - * @covers JStringInflector::_addRule */ - public function test_addRule() + public function testAddRule() { // Case 1 - TestReflection::invoke($this->inflector, '_addRule', '/foo/', 'singular'); + TestReflection::invoke($this->inflector, 'addRule', '/foo/', 'singular'); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('/foo/', $rules['singular']), @@ -118,9 +117,9 @@ public function test_addRule() ); // Case 2 - TestReflection::invoke($this->inflector, '_addRule', '/bar/', 'plural'); + TestReflection::invoke($this->inflector, 'addRule', '/bar/', 'plural'); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('/bar/', $rules['plural']), @@ -129,9 +128,9 @@ public function test_addRule() ); // Case 3 - TestReflection::invoke($this->inflector, '_addRule', array('/goo/', '/car/'), 'singular'); + TestReflection::invoke($this->inflector, 'addRule', array('/goo/', '/car/'), 'singular'); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('/goo/', $rules['singular']), @@ -147,113 +146,108 @@ public function test_addRule() } /** - * Method to test JStringInflector::_addRule(). + * Method to test JStringInflector::addRule(). * * @return void * * @since 12.1 * @expectedException InvalidArgumentException - * @covers JStringInflector::_addRule */ - public function test_addRuleException() + public function testaddRuleException() { - TestReflection::invoke($this->inflector, '_addRule', new stdClass, 'singular'); + TestReflection::invoke($this->inflector, 'addRule', new stdClass, 'singular'); } /** - * Method to test JStringInflector::_getCachedPlural(). + * Method to test JStringInflector::getCachedPlural(). * * @return void * * @since 12.1 - * @covers JStringInflector::_getCachedPlural */ - public function test_getCachedPlural() + public function testGetCachedPlural() { // Reset the cache. - TestReflection::setValue($this->inflector, '_cache', array('foo' => 'bar')); + TestReflection::setValue($this->inflector, 'cache', array('foo' => 'bar')); $this->assertThat( - TestReflection::invoke($this->inflector, '_getCachedPlural', 'bar'), + TestReflection::invoke($this->inflector, 'getCachedPlural', 'bar'), $this->isFalse(), 'Checks for an uncached plural.' ); $this->assertThat( - TestReflection::invoke($this->inflector, '_getCachedPlural', 'foo'), + TestReflection::invoke($this->inflector, 'getCachedPlural', 'foo'), $this->equalTo('bar'), 'Checks for a cached plural word.' ); } /** - * Method to test JStringInflector::_getCachedSingular(). + * Method to test JStringInflector::getCachedSingular(). * * @return void * * @since 12.1 - * @covers JStringInflector::_getCachedSingular */ - public function test_getCachedSingular() + public function testGetCachedSingular() { // Reset the cache. - TestReflection::setValue($this->inflector, '_cache', array('foo' => 'bar')); + TestReflection::setValue($this->inflector, 'cache', array('foo' => 'bar')); $this->assertThat( - TestReflection::invoke($this->inflector, '_getCachedSingular', 'foo'), + TestReflection::invoke($this->inflector, 'getCachedSingular', 'foo'), $this->isFalse(), 'Checks for an uncached singular.' ); $this->assertThat( - TestReflection::invoke($this->inflector, '_getCachedSingular', 'bar'), + TestReflection::invoke($this->inflector, 'getCachedSingular', 'bar'), $this->equalTo('foo'), 'Checks for a cached singular word.' ); } /** - * Method to test JStringInflector::_matchRegexRule(). + * Method to test JStringInflector::matchRegexRule(). * * @return void * * @since 12.1 - * @covers JStringInflector::_matchRegexRule */ - public function test_matchRegexRule() + public function testMatchRegexRule() { $this->assertThat( - TestReflection::invoke($this->inflector, '_matchRegexRule', 'xyz', 'plural'), + TestReflection::invoke($this->inflector, 'matchRegexRule', 'xyz', 'plural'), $this->equalTo('xyzs'), 'Checks pluralising against the basic regex.' ); $this->assertThat( - TestReflection::invoke($this->inflector, '_matchRegexRule', 'xyzs', 'singular'), + TestReflection::invoke($this->inflector, 'matchRegexRule', 'xyzs', 'singular'), $this->equalTo('xyz'), 'Checks singularising against the basic regex.' ); $this->assertThat( - TestReflection::invoke($this->inflector, '_matchRegexRule', 'xyz', 'singular'), + TestReflection::invoke($this->inflector, 'matchRegexRule', 'xyz', 'singular'), $this->isFalse(), 'Checks singularising against an unmatched regex.' ); } /** - * Method to test JStringInflector::_setCache(). + * Method to test JStringInflector::setCache(). * * @return void * * @since 12.1 - * @covers JStringInflector::_setCache */ - public function test_setCache() + public function testSetCache() { - TestReflection::invoke($this->inflector, '_setCache', 'foo', 'bar'); + TestReflection::invoke($this->inflector, 'setCache', 'foo', 'bar'); - $cache = TestReflection::getValue($this->inflector, '_cache'); + $cache = TestReflection::getValue($this->inflector, 'cache'); $this->assertThat( $cache['foo'], @@ -261,9 +255,9 @@ public function test_setCache() 'Checks the cache was set.' ); - TestReflection::invoke($this->inflector, '_setCache', 'foo', 'car'); + TestReflection::invoke($this->inflector, 'setCache', 'foo', 'car'); - $cache = TestReflection::getValue($this->inflector, '_cache'); + $cache = TestReflection::getValue($this->inflector, 'cache'); $this->assertThat( $cache['foo'], @@ -278,14 +272,13 @@ public function test_setCache() * @return void * * @since 12.1 - * @covers JStringInflector::addCountableRule */ public function testAddCountableRule() { // Add string. $this->inflector->addCountableRule('foo'); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('foo', $rules['countable']), @@ -296,7 +289,7 @@ public function testAddCountableRule() // Add array. $this->inflector->addCountableRule(array('goo', 'car')); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('car', $rules['countable']), @@ -311,7 +304,6 @@ public function testAddCountableRule() * @return void * * @since 12.1 - * @covers JStringInflector::addPluraliseRule */ public function testAddPluraliseRule() { @@ -323,7 +315,7 @@ public function testAddPluraliseRule() 'Checks chaining.' ); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('/bar/', $rules['plural']), @@ -338,7 +330,6 @@ public function testAddPluraliseRule() * @return void * * @since 12.1 - * @covers JStringInflector::addSingulariseRule */ public function testAddSingulariseRule() { @@ -350,7 +341,7 @@ public function testAddSingulariseRule() 'Checks chaining.' ); - $rules = TestReflection::getValue($this->inflector, '_rules'); + $rules = TestReflection::getValue($this->inflector, 'rules'); $this->assertThat( in_array('/bar/', $rules['singular']), @@ -365,7 +356,6 @@ public function testAddSingulariseRule() * @return void * * @since 12.1 - * @covers JStringInflector::getInstance */ public function testGetInstance() { @@ -376,7 +366,7 @@ public function testGetInstance() ); // Inject an instance an test. - TestReflection::setValue($this->inflector, '_instance', new stdClass); + TestReflection::setValue($this->inflector, 'instance', new stdClass); $this->assertThat( JStringInflector::getInstance(), @@ -401,7 +391,6 @@ public function testGetInstance() * * @dataProvider seedIsCountable * @since 12.1 - * @covers JStringInflector::isCountable */ public function testIsCountable($input, $expected) { @@ -421,7 +410,6 @@ public function testIsCountable($input, $expected) * * @dataProvider seedSinglePlural * @since 12.1 - * @covers JStringInflector::isPlural */ public function testIsPlural($singular, $plural) { @@ -451,7 +439,6 @@ public function testIsPlural($singular, $plural) * * @dataProvider seedSinglePlural * @since 12.1 - * @covers JStringInflector::isSingular */ public function testIsSingular($singular, $plural) { @@ -481,7 +468,6 @@ public function testIsSingular($singular, $plural) * * @dataProvider seedSinglePlural * @since 12.1 - * @covers JStringInflector::toPlural */ public function testToPlural($singular, $plural) { @@ -501,7 +487,6 @@ public function testToPlural($singular, $plural) * * @dataProvider seedSinglePlural * @since 12.1 - * @covers JStringInflector::toSingular */ public function testToSingular($singular, $plural) { diff --git a/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php b/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php index ca4d8b808197d..67b37ae69d029 100644 --- a/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php +++ b/tests/unit/suites/libraries/joomla/string/TestHelpers/JString-helper-dataset.php @@ -217,9 +217,9 @@ class JStringTest_DataSet * @since 11.2 */ static public $substr_replaceTests = array( - array('321 Main Street', 'Broadway Avenue', 4, false, '321 Broadway Avenue'), + array('321 Main Street', 'Broadway Avenue', 4, null, '321 Broadway Avenue'), array('321 Main Street', 'Broadway', 4, 4, '321 Broadway Street'), - array('чадна Би шил идэй чадна', '我能吞', 6, false, 'чадна 我能吞'), + array('чадна Би шил идэй чадна', '我能吞', 6, null, 'чадна 我能吞'), array('чадна Би шил идэй чадна', '我能吞', 6, 2, 'чадна 我能吞 шил идэй чадна') );