Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268899

Change subject: Update pear/mail 1.2.0 -> 1.3.0
......................................................................

Update pear/mail 1.2.0 -> 1.3.0

https://github.com/pear/Mail/compare/1.2.0...1.3.0

Drops PHP4 support. Improves PHP 7 support

Change-Id: Iabeda04aa1194aca5e797dcf90b0ad9b480d3402
---
M composer.json
M composer.lock
M composer/installed.json
A pear/mail/.gitignore
A pear/mail/.travis.yml
M pear/mail/Mail.php
M pear/mail/Mail/RFC822.php
M pear/mail/Mail/mail.php
M pear/mail/Mail/mock.php
M pear/mail/Mail/null.php
M pear/mail/Mail/sendmail.php
M pear/mail/Mail/smtp.php
M pear/mail/Mail/smtpmx.php
A pear/mail/README.rst
M pear/mail/composer.json
M pear/mail/package.xml
M pear/mail/tests/13659.phpt
A pear/mail/tests/Makefile
A pear/mail/tests/bug17178.phpt
A pear/mail/tests/bug17317.phpt
M pear/mail/tests/rfc822.phpt
M pear/mail/tests/smtp_error.phpt
22 files changed, 303 insertions(+), 214 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor 
refs/changes/99/268899/1

diff --git a/composer.json b/composer.json
index 65e50f3..c984cc0 100644
--- a/composer.json
+++ b/composer.json
@@ -19,7 +19,7 @@
                "oojs/oojs-ui": "0.15.2",
                "oyejorge/less.php": "1.7.0.10",
                "pear/console_getopt": "1.4.1",
-               "pear/mail": "1.2.0",
+               "pear/mail": "1.3.0",
                "pear/mail_mime": "1.10.0",
                "pear/mail_mime-decode": "1.5.5.2",
                "pear/net_smtp": "1.7.1",
diff --git a/composer.lock b/composer.lock
index 625a84d..10dc64f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
         "Read more about it at 
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
         "This file is @generated automatically"
     ],
-    "hash": "7f3f211f67f5a592871ced813284a0a8",
-    "content-hash": "7f19115f07b3948409e6c52f3f391760",
+    "hash": "830da33b9ff9b8b8d25d87c1a4db2095",
+    "content-hash": "8ffb92c59764cadc68596ebe14e7a8e1",
     "packages": [
         {
             "name": "composer/semver",
@@ -551,20 +551,21 @@
         },
         {
             "name": "pear/mail",
-            "version": "1.2.0",
+            "version": "1.3.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/pear/Mail.git";,
-                "reference": "19c4c78e39027374c012f32e489bbd3c6c47fb5e"
+                "reference": "8a7305cb507b460e03e55e0ac84c67c8358c9b44"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/pear/Mail/zipball/19c4c78e39027374c012f32e489bbd3c6c47fb5e";,
-                "reference": "19c4c78e39027374c012f32e489bbd3c6c47fb5e",
+                "url": 
"https://api.github.com/repos/pear/Mail/zipball/8a7305cb507b460e03e55e0ac84c67c8358c9b44";,
+                "reference": "8a7305cb507b460e03e55e0ac84c67c8358c9b44",
                 "shasum": ""
             },
             "require": {
-                "pear/pear-core-minimal": "*"
+                "pear/pear-core-minimal": "*",
+                "php": ">=5.2.1"
             },
             "require-dev": {
                 "pear/pear": "*"
@@ -604,7 +605,7 @@
             ],
             "description": "Class that provides multiple interfaces for 
sending emails.",
             "homepage": "http://pear.php.net/package/Mail";,
-            "time": "2016-01-09 07:14:03"
+            "time": "2016-01-31 21:32:18"
         },
         {
             "name": "pear/mail_mime",
diff --git a/composer/installed.json b/composer/installed.json
index 3303b5c..4788e2c 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -1459,65 +1459,6 @@
         "description": "More info available on: 
http://pear.php.net/package/Net_Socket";
     },
     {
-        "name": "pear/mail",
-        "version": "1.2.0",
-        "version_normalized": "1.2.0.0",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/pear/Mail.git";,
-            "reference": "19c4c78e39027374c012f32e489bbd3c6c47fb5e"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/pear/Mail/zipball/19c4c78e39027374c012f32e489bbd3c6c47fb5e";,
-            "reference": "19c4c78e39027374c012f32e489bbd3c6c47fb5e",
-            "shasum": ""
-        },
-        "require": {
-            "pear/pear-core-minimal": "*"
-        },
-        "require-dev": {
-            "pear/pear": "*"
-        },
-        "suggest": {
-            "pear/net_smtp": "Install optionally via your project's 
composer.json"
-        },
-        "time": "2016-01-09 07:14:03",
-        "type": "library",
-        "installation-source": "dist",
-        "autoload": {
-            "psr-0": {
-                "Mail": "./"
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "include-path": [
-            "./"
-        ],
-        "license": [
-            "BSD-2-Clause"
-        ],
-        "authors": [
-            {
-                "name": "Chuck Hagenbuch",
-                "email": "ch...@horde.org",
-                "role": "Lead"
-            },
-            {
-                "name": "Richard Heyes",
-                "email": "rich...@phpguru.org",
-                "role": "Developer"
-            },
-            {
-                "name": "Aleksander Machniak",
-                "email": "a...@alec.pl",
-                "role": "Developer"
-            }
-        ],
-        "description": "Class that provides multiple interfaces for sending 
emails.",
-        "homepage": "http://pear.php.net/package/Mail";
-    },
-    {
         "name": "ruflin/elastica",
         "version": "2.2.1",
         "version_normalized": "2.2.1.0",
@@ -1720,5 +1661,65 @@
             "php",
             "stylesheet"
         ]
+    },
+    {
+        "name": "pear/mail",
+        "version": "1.3.0",
+        "version_normalized": "1.3.0.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/pear/Mail.git";,
+            "reference": "8a7305cb507b460e03e55e0ac84c67c8358c9b44"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/pear/Mail/zipball/8a7305cb507b460e03e55e0ac84c67c8358c9b44";,
+            "reference": "8a7305cb507b460e03e55e0ac84c67c8358c9b44",
+            "shasum": ""
+        },
+        "require": {
+            "pear/pear-core-minimal": "*",
+            "php": ">=5.2.1"
+        },
+        "require-dev": {
+            "pear/pear": "*"
+        },
+        "suggest": {
+            "pear/net_smtp": "Install optionally via your project's 
composer.json"
+        },
+        "time": "2016-01-31 21:32:18",
+        "type": "library",
+        "installation-source": "dist",
+        "autoload": {
+            "psr-0": {
+                "Mail": "./"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "include-path": [
+            "./"
+        ],
+        "license": [
+            "BSD-2-Clause"
+        ],
+        "authors": [
+            {
+                "name": "Chuck Hagenbuch",
+                "email": "ch...@horde.org",
+                "role": "Lead"
+            },
+            {
+                "name": "Richard Heyes",
+                "email": "rich...@phpguru.org",
+                "role": "Developer"
+            },
+            {
+                "name": "Aleksander Machniak",
+                "email": "a...@alec.pl",
+                "role": "Developer"
+            }
+        ],
+        "description": "Class that provides multiple interfaces for sending 
emails.",
+        "homepage": "http://pear.php.net/package/Mail";
     }
 ]
diff --git a/pear/mail/.gitignore b/pear/mail/.gitignore
new file mode 100644
index 0000000..869f498
--- /dev/null
+++ b/pear/mail/.gitignore
@@ -0,0 +1,4 @@
+# composer related
+composer.lock
+composer.phar
+vendor
diff --git a/pear/mail/.travis.yml b/pear/mail/.travis.yml
new file mode 100644
index 0000000..2d35ed7
--- /dev/null
+++ b/pear/mail/.travis.yml
@@ -0,0 +1,15 @@
+language: php
+sudo: false
+install:
+  - pear install package.xml
+  - pear install net_smtp
+php:
+  - 5.2
+  - 5.3
+  - 5.4
+  - 5.5
+  - 5.6
+  - 7
+script:
+  - pear run-tests tests
+  - for i in `ls tests/*.diff`; do echo $i; cat $i; done
diff --git a/pear/mail/Mail.php b/pear/mail/Mail.php
index 64858b8..e7cff2f 100644
--- a/pear/mail/Mail.php
+++ b/pear/mail/Mail.php
@@ -1,8 +1,8 @@
 <?php
 /**
- *  PEAR's Mail:: interface.
+ * PEAR's Mail:: interface.
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -50,7 +50,6 @@
  * mailers under the PEAR hierarchy, and provides supporting functions
  * useful in multiple mailer backends.
  *
- * @access public
  * @version $Revision$
  * @package Mail
  */
@@ -60,7 +59,7 @@
      * Line terminator used for separating header lines.
      * @var string
      */
-    var $sep = "\r\n";
+    public $sep = "\r\n";
 
     /**
      * Provides an interface for generating Mail:: objects of various
@@ -68,10 +67,10 @@
      *
      * @param string $driver The kind of Mail:: object to instantiate.
      * @param array  $params The parameters to pass to the Mail:: object.
+     *
      * @return object Mail a instance of the driver class or if fails a PEAR 
Error
-     * @access public
      */
-    function &factory($driver, $params = array())
+    public static function factory($driver, $params = array())
     {
         $driver = strtolower($driver);
         @include_once 'Mail/' . $driver . '.php';
@@ -108,10 +107,9 @@
      *               containing a descriptive error message on
      *               failure.
      *
-     * @access public
      * @deprecated use Mail_mail::send instead
      */
-    function send($recipients, $headers, $body)
+    public function send($recipients, $headers, $body)
     {
         if (!is_array($headers)) {
             return PEAR::raiseError('$headers must be an array');
@@ -147,10 +145,8 @@
      * filter is to prevent mail injection attacks.
      *
      * @param array $headers The associative array of headers to sanitize.
-     *
-     * @access private
      */
-    function _sanitizeHeaders(&$headers)
+    protected function _sanitizeHeaders(&$headers)
     {
         foreach ($headers as $key => $value) {
             $headers[$key] =
@@ -173,9 +169,8 @@
      *               otherwise returns an array containing two
      *               elements: Any From: address found in the headers,
      *               and the plain text version of the headers.
-     * @access private
      */
-    function prepareHeaders($headers)
+    protected function prepareHeaders($headers)
     {
         $lines = array();
         $from = null;
@@ -235,9 +230,8 @@
      *
      * @return mixed An array of forward paths (bare addresses) or a PEAR_Error
      *               object if the address list could not be parsed.
-     * @access private
      */
-    function parseRecipients($recipients)
+    protected function parseRecipients($recipients)
     {
         include_once 'Mail/RFC822.php';
 
@@ -250,7 +244,8 @@
         // Parse recipients, leaving out all personal info. This is
         // for smtp recipients, etc. All relevant personal information
         // should already be in the headers.
-        $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', 
false);
+        $Mail_RFC822 = new Mail_RFC822();
+        $addresses = $Mail_RFC822->parseAddressList($recipients, 'localhost', 
false);
 
         // If parseAddressList() returned a PEAR_Error object, just return it.
         if (is_a($addresses, 'PEAR_Error')) {
diff --git a/pear/mail/Mail/RFC822.php b/pear/mail/Mail/RFC822.php
index ee4d968..d010a20 100644
--- a/pear/mail/Mail/RFC822.php
+++ b/pear/mail/Mail/RFC822.php
@@ -2,7 +2,7 @@
 /**
  * RFC 822 Email address list validation Utility
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -141,7 +141,6 @@
      * Sets up the object. The address must either be set here or when
      * calling parseAddressList(). One or the other.
      *
-     * @access public
      * @param string  $address         The address(es) to validate.
      * @param string  $default_domain  Default domain/host etc. If not 
supplied, will be set to localhost.
      * @param boolean $nest_groups     Whether to return the structure with 
groups nested for easier viewing.
@@ -149,7 +148,7 @@
      *
      * @return object Mail_RFC822 A new Mail_RFC822 object.
      */
-    function Mail_RFC822($address = null, $default_domain = null, $nest_groups 
= null, $validate = null, $limit = null)
+    public function __construct($address = null, $default_domain = null, 
$nest_groups = null, $validate = null, $limit = null)
     {
         if (isset($address))        $this->address        = $address;
         if (isset($default_domain)) $this->default_domain = $default_domain;
@@ -162,7 +161,6 @@
      * Starts the whole process. The address must either be set here
      * or when creating the object. One or the other.
      *
-     * @access public
      * @param string  $address         The address(es) to validate.
      * @param string  $default_domain  Default domain/host etc.
      * @param boolean $nest_groups     Whether to return the structure with 
groups nested for easier viewing.
@@ -170,7 +168,7 @@
      *
      * @return array A structured array of addresses.
      */
-    function parseAddressList($address = null, $default_domain = null, 
$nest_groups = null, $validate = null, $limit = null)
+    public function parseAddressList($address = null, $default_domain = null, 
$nest_groups = null, $validate = null, $limit = null)
     {
         if (!isset($this) || !isset($this->mailRFC822)) {
             $obj = new Mail_RFC822($address, $default_domain, $nest_groups, 
$validate, $limit);
@@ -222,11 +220,10 @@
     /**
      * Splits an address into separate addresses.
      *
-     * @access private
      * @param string $address The addresses to split.
      * @return boolean Success or failure.
      */
-    function _splitAddresses($address)
+    protected function _splitAddresses($address)
     {
         if (!empty($this->limit) && count($this->addresses) == $this->limit) {
             return '';
@@ -298,11 +295,10 @@
     /**
      * Checks for a group at the start of the string.
      *
-     * @access private
      * @param string $address The address to check.
      * @return boolean Whether or not there is a group at the start of the 
string.
      */
-    function _isGroup($address)
+    protected function _isGroup($address)
     {
         // First comma not in quotes, angles or escaped:
         $parts  = explode(',', $address);
@@ -322,12 +318,11 @@
     /**
      * A common function that will check an exploded string.
      *
-     * @access private
      * @param array $parts The exloded string.
      * @param string $char  The char that was exploded on.
      * @return mixed False if the string contains unclosed quotes/brackets, or 
the string on success.
      */
-    function _splitCheck($parts, $char)
+    protected function _splitCheck($parts, $char)
     {
         $string = $parts[0];
 
@@ -355,12 +350,11 @@
     /**
      * Checks if a string has unclosed quotes or not.
      *
-     * @access private
      * @param string $string  The string to check.
      * @return boolean  True if there are unclosed quotes inside the string,
      *                  false otherwise.
      */
-    function _hasUnclosedQuotes($string)
+    protected function _hasUnclosedQuotes($string)
     {
         $string = trim($string);
         $iMax = strlen($string);
@@ -392,12 +386,11 @@
      * Checks if a string has an unclosed brackets or not. IMPORTANT:
      * This function handles both angle brackets and square brackets;
      *
-     * @access private
      * @param string $string The string to check.
      * @param string $chars  The characters to check for.
      * @return boolean True if there are unclosed brackets inside the string, 
false otherwise.
      */
-    function _hasUnclosedBrackets($string, $chars)
+    protected function _hasUnclosedBrackets($string, $chars)
     {
         $num_angle_start = substr_count($string, $chars[0]);
         $num_angle_end   = substr_count($string, $chars[1]);
@@ -416,13 +409,12 @@
     /**
      * Sub function that is used only by hasUnclosedBrackets().
      *
-     * @access private
      * @param string $string The string to check.
      * @param integer &$num    The number of occurences.
      * @param string $char   The character to count.
      * @return integer The number of occurences of $char in $string, adjusted 
for backslashes.
      */
-    function _hasUnclosedBracketsSub($string, &$num, $char)
+    protected function _hasUnclosedBracketsSub($string, &$num, $char)
     {
         $parts = explode($char, $string);
         for ($i = 0; $i < count($parts); $i++){
@@ -438,11 +430,10 @@
     /**
      * Function to begin checking the address.
      *
-     * @access private
      * @param string $address The address to validate.
      * @return mixed False on failure, or a structured array of address 
information on success.
      */
-    function _validateAddress($address)
+    protected function _validateAddress($address)
     {
         $is_group = false;
         $addresses = array();
@@ -481,14 +472,6 @@
             }
         } else {
             $addresses[] = $address['address'];
-        }
-
-        // Check that $addresses is set, if address like this:
-        // Groupname:;
-        // Then errors were appearing.
-        if (!count($addresses)){
-            $this->error = 'Empty group.';
-            return false;
         }
 
         // Trim the whitespace from all of the address strings.
@@ -531,11 +514,10 @@
     /**
      * Function to validate a phrase.
      *
-     * @access private
      * @param string $phrase The phrase to check.
      * @return boolean Success or failure.
      */
-    function _validatePhrase($phrase)
+    protected function _validatePhrase($phrase)
     {
         // Splits on one or more Tab or space.
         $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY);
@@ -572,11 +554,10 @@
      * can split a list of addresses up before encoding personal names
      * (umlauts, etc.), for example.
      *
-     * @access private
      * @param string $atom The string to check.
      * @return boolean Success or failure.
      */
-    function _validateAtom($atom)
+    protected function _validateAtom($atom)
     {
         if (!$this->validate) {
             // Validation has been turned off; assume the atom is okay.
@@ -605,11 +586,10 @@
      * Function to validate quoted string, which is:
      * quoted-string = <"> *(qtext/quoted-pair) <">
      *
-     * @access private
      * @param string $qstring The string to check
      * @return boolean Success or failure.
      */
-    function _validateQuotedString($qstring)
+    protected function _validateQuotedString($qstring)
     {
         // Leading and trailing "
         $qstring = substr($qstring, 1, -1);
@@ -623,11 +603,10 @@
      * mailbox =   addr-spec         ; simple address
      *           / phrase route-addr ; name and route-addr
      *
-     * @access public
      * @param string &$mailbox The string to check.
      * @return boolean Success or failure.
      */
-    function validateMailbox(&$mailbox)
+    public function validateMailbox(&$mailbox)
     {
         // A couple of defaults.
         $phrase  = '';
@@ -712,11 +691,10 @@
      * Angle brackets have already been removed at the point of
      * getting to this function.
      *
-     * @access private
      * @param string $route_addr The string to check.
      * @return mixed False on failure, or an array containing validated 
address/route information on success.
      */
-    function _validateRouteAddr($route_addr)
+    protected function _validateRouteAddr($route_addr)
     {
         // Check for colon.
         if (strpos($route_addr, ':') !== false) {
@@ -762,11 +740,10 @@
      * Function to validate a route, which is:
      * route = 1#("@" domain) ":"
      *
-     * @access private
      * @param string $route The string to check.
      * @return mixed False on failure, or the validated $route on success.
      */
-    function _validateRoute($route)
+    protected function _validateRoute($route)
     {
         // Split on comma.
         $domains = explode(',', trim($route));
@@ -785,11 +762,10 @@
      *
      * domain = sub-domain *("." sub-domain)
      *
-     * @access private
      * @param string $domain The string to check.
      * @return mixed False on failure, or the validated domain on success.
      */
-    function _validateDomain($domain)
+    protected function _validateDomain($domain)
     {
         // Note the different use of $subdomains and $sub_domains
         $subdomains = explode('.', $domain);
@@ -813,11 +789,10 @@
      * Function to validate a subdomain:
      *   subdomain = domain-ref / domain-literal
      *
-     * @access private
      * @param string $subdomain The string to check.
      * @return boolean Success or failure.
      */
-    function _validateSubdomain($subdomain)
+    protected function _validateSubdomain($subdomain)
     {
         if (preg_match('|^\[(.*)]$|', $subdomain, $arr)){
             if (!$this->_validateDliteral($arr[1])) return false;
@@ -833,11 +808,10 @@
      * Function to validate a domain literal:
      *   domain-literal =  "[" *(dtext / quoted-pair) "]"
      *
-     * @access private
      * @param string $dliteral The string to check.
      * @return boolean Success or failure.
      */
-    function _validateDliteral($dliteral)
+    protected function _validateDliteral($dliteral)
     {
         return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && 
$matches[1] != '\\';
     }
@@ -847,11 +821,10 @@
      *
      * addr-spec = local-part "@" domain
      *
-     * @access private
      * @param string $addr_spec The string to check.
      * @return mixed False on failure, or the validated addr-spec on success.
      */
-    function _validateAddrSpec($addr_spec)
+    protected function _validateAddrSpec($addr_spec)
     {
         $addr_spec = trim($addr_spec);
 
@@ -878,17 +851,16 @@
      * Function to validate the local part of an address:
      *   local-part = word *("." word)
      *
-     * @access private
      * @param string $local_part
      * @return mixed False on failure, or the validated local part on success.
      */
-    function _validateLocalPart($local_part)
+    protected function _validateLocalPart($local_part)
     {
         $parts = explode('.', $local_part);
         $words = array();
 
         // Split the local_part into words.
-        while (count($parts) > 0){
+        while (count($parts) > 0) {
             $words[] = $this->_splitCheck($parts, '.');
             for ($i = 0; $i < $this->index + 1; $i++) {
                 array_shift($parts);
@@ -897,6 +869,10 @@
 
         // Validate each word.
         foreach ($words as $word) {
+            // word cannot be empty (#17317)
+            if ($word === '') {
+                return false;
+            }
             // If this word contains an unquoted space, it is invalid. (6.2.4)
             if (strpos($word, ' ') && $word[0] !== '"')
             {
@@ -920,7 +896,7 @@
      * @param  string $data Addresses to count
      * @return int          Approximate count
      */
-    function approximateCount($data)
+    public function approximateCount($data)
     {
         return count(preg_split('/(?<!\\\\),/', $data));
     }
@@ -938,7 +914,7 @@
      * @return mixed           False if it fails, an indexed array
      *                         username/domain if it matches
      */
-    function isValidInetAddress($data, $strict = false)
+    public function isValidInetAddress($data, $strict = false)
     {
         $regex = $strict ? 
'/^([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i' : 
'/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i';
         if (preg_match($regex, trim($data), $matches)) {
diff --git a/pear/mail/Mail/mail.php b/pear/mail/Mail/mail.php
index 1754706..4d21dc2 100644
--- a/pear/mail/Mail/mail.php
+++ b/pear/mail/Mail/mail.php
@@ -2,7 +2,7 @@
 /**
  * internal PHP-mail() implementation of the PEAR Mail:: interface.
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -64,7 +64,7 @@
      *
      * @param array $params Extra arguments for the mail() function.
      */
-    function Mail_mail($params = null)
+    public function __construct($params = null)
     {
         // The other mail implementations accept parameters as arrays.
         // In the interest of being consistent, explode an array into
@@ -109,10 +109,8 @@
      * @return mixed Returns true on success, or a PEAR_Error
      *               containing a descriptive error message on
      *               failure.
-     *
-     * @access public
      */
-    function send($recipients, $headers, $body)
+    public function send($recipients, $headers, $body)
     {
         if (!is_array($headers)) {
             return PEAR::raiseError('$headers must be an array');
diff --git a/pear/mail/Mail/mock.php b/pear/mail/Mail/mock.php
index ba24716..e3e290b 100644
--- a/pear/mail/Mail/mock.php
+++ b/pear/mail/Mail/mock.php
@@ -2,7 +2,7 @@
 /**
  * Mock implementation
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -55,23 +55,22 @@
      * Array of messages that have been sent with the mock.
      *
      * @var array
-     * @access public
      */
-    var $sentMessages = array();
+    public $sentMessages = array();
 
     /**
      * Callback before sending mail.
      *
      * @var callback
      */
-    var $_preSendCallback;
+    protected $_preSendCallback;
 
     /**
      * Callback after sending mai.
      *
      * @var callback
      */
-    var $_postSendCallback;
+    protected $_postSendCallback;
 
     /**
      * Constructor.
@@ -82,9 +81,8 @@
      *     postSendCallback  Called after an email would have been sent.
      *
      * @param array Hash containing any parameters.
-     * @access public
      */
-    function Mail_mock($params)
+    public function __construct($params)
     {
         if (isset($params['preSendCallback']) &&
             is_callable($params['preSendCallback'])) {
@@ -120,9 +118,8 @@
      * @return mixed Returns true on success, or a PEAR_Error
      *               containing a descriptive error message on
      *               failure.
-     * @access public
      */
-    function send($recipients, $headers, $body)
+    public function send($recipients, $headers, $body)
     {
         if ($this->_preSendCallback) {
             call_user_func_array($this->_preSendCallback,
diff --git a/pear/mail/Mail/null.php b/pear/mail/Mail/null.php
index c8d9fbc..7896a42 100644
--- a/pear/mail/Mail/null.php
+++ b/pear/mail/Mail/null.php
@@ -2,7 +2,7 @@
 /**
  * Null implementation of the PEAR Mail interface
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -74,9 +74,8 @@
      * @return mixed Returns true on success, or a PEAR_Error
      *               containing a descriptive error message on
      *               failure.
-     * @access public
      */
-    function send($recipients, $headers, $body)
+    public function send($recipients, $headers, $body)
     {
         return true;
     }
diff --git a/pear/mail/Mail/sendmail.php b/pear/mail/Mail/sendmail.php
index 627b0e8..f8866bd 100644
--- a/pear/mail/Mail/sendmail.php
+++ b/pear/mail/Mail/sendmail.php
@@ -1,7 +1,7 @@
 <?php
 //
 // +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
+// | PHP Version 5                                                        |
 // +----------------------------------------------------------------------+
 // | Copyright (c) 1997-2003 The PHP Group                                |
 // +----------------------------------------------------------------------+
@@ -54,9 +54,8 @@
      *
      * @param array $params Hash containing any parameters different from the
      *              defaults.
-     * @access public
      */
-    function Mail_sendmail($params)
+    public function __construct($params)
     {
         if (isset($params['sendmail_path'])) {
             $this->sendmail_path = $params['sendmail_path'];
@@ -100,9 +99,8 @@
      * @return mixed Returns true on success, or a PEAR_Error
      *               containing a descriptive error message on
      *               failure.
-     * @access public
      */
-    function send($recipients, $headers, $body)
+    public function send($recipients, $headers, $body)
     {
         if (!is_array($headers)) {
             return PEAR::raiseError('$headers must be an array');
diff --git a/pear/mail/Mail/smtp.php b/pear/mail/Mail/smtp.php
index 2fea52d..d446b1b 100644
--- a/pear/mail/Mail/smtp.php
+++ b/pear/mail/Mail/smtp.php
@@ -2,7 +2,7 @@
 /**
  * SMTP implementation of the PEAR Mail interface. Requires the Net_SMTP class.
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -162,6 +162,8 @@
      * @var bool
      */
     var $pipelining;
+    
+    var $socket_options = array();
 
     /**
      * Constructor.
@@ -186,9 +188,8 @@
      *
      * @param array Hash containing any parameters different from the
      *              defaults.
-     * @access public
      */
-    function Mail_smtp($params)
+    public function __construct($params)
     {
         if (isset($params['host'])) $this->host = $params['host'];
         if (isset($params['port'])) $this->port = $params['port'];
@@ -200,20 +201,18 @@
         if (isset($params['debug'])) $this->debug = (bool)$params['debug'];
         if (isset($params['persist'])) $this->persist = 
(bool)$params['persist'];
         if (isset($params['pipelining'])) $this->pipelining = 
(bool)$params['pipelining'];
-
+        if (isset($params['socket_options'])) $this->socket_options = 
$params['socket_options'];
         // Deprecated options
         if (isset($params['verp'])) {
             $this->addServiceExtensionParameter('XVERP', 
is_bool($params['verp']) ? null : $params['verp']);
         }
-
-        register_shutdown_function(array(&$this, '_Mail_smtp'));
     }
 
     /**
      * Destructor implementation to ensure that we disconnect from any
      * potentially-alive persistent SMTP connections.
      */
-    function _Mail_smtp()
+    public function __destruct()
     {
         $this->disconnect();
     }
@@ -240,12 +239,11 @@
      * @return mixed Returns true on success, or a PEAR_Error
      *               containing a descriptive error message on
      *               failure.
-     * @access public
      */
-    function send($recipients, $headers, $body)
+    public function send($recipients, $headers, $body)
     {
         /* If we don't already have an SMTP object, create one. */
-        $result = &$this->getSMTPObject();
+        $result = $this->getSMTPObject();
         if (PEAR::isError($result)) {
             return $result;
         }
@@ -304,7 +302,7 @@
         }
 
         /* Send the message's headers and the body as SMTP data. */
-        $res = $this->_smtp->data($textHeaders . "\r\n\r\n" . $body);
+        $res = $this->_smtp->data($body, $textHeaders);
                list(,$args) = $this->_smtp->getResponse();
 
                if (preg_match("/Ok: queued as (.*)/", $args, $queued)) {
@@ -337,18 +335,20 @@
      *               failure.
      *
      * @since  1.2.0
-     * @access public
      */
-    function &getSMTPObject()
+    public function getSMTPObject()
     {
         if (is_object($this->_smtp) !== false) {
             return $this->_smtp;
         }
 
         include_once 'Net/SMTP.php';
-        $this->_smtp = &new Net_SMTP($this->host,
+        $this->_smtp = new Net_SMTP($this->host,
                                      $this->port,
-                                     $this->localhost);
+                                     $this->localhost,
+                                     $this->pipelining,
+                                     0,
+                                     $this->socket_options);
 
         /* If we still don't have an SMTP object at this point, fail. */
         if (is_object($this->_smtp) === false) {
@@ -393,9 +393,8 @@
      * @param string Any value the keyword needs.
      *
      * @since 1.2.0
-     * @access public
      */
-    function addServiceExtensionParameter($keyword, $value = null)
+    public function addServiceExtensionParameter($keyword, $value = null)
     {
         $this->_extparams[$keyword] = $value;
     }
@@ -406,9 +405,8 @@
      * @return boolean True if the SMTP connection no longer exists.
      *
      * @since  1.1.9
-     * @access public
      */
-    function disconnect()
+    public function disconnect()
     {
         /* If we have an SMTP object, disconnect and destroy it. */
         if (is_object($this->_smtp) && $this->_smtp->disconnect()) {
@@ -428,9 +426,8 @@
      * @return string       A string describing the current SMTP error.
      *
      * @since  1.1.7
-     * @access private
      */
-    function _error($text, &$error)
+    protected function _error($text, $error)
     {
         /* Split the SMTP response into a code and a response string. */
         list($code, $response) = $this->_smtp->getResponse();
diff --git a/pear/mail/Mail/smtpmx.php b/pear/mail/Mail/smtpmx.php
index b89cb28..6eb8bec 100644
--- a/pear/mail/Mail/smtpmx.php
+++ b/pear/mail/Mail/smtpmx.php
@@ -6,7 +6,7 @@
  *
  * SMTP MX implementation of the PEAR Mail interface. Requires the Net_SMTP 
class.
  *
- * PHP versions 4 and 5
+ * PHP version 5
  *
  * LICENSE:
  *
@@ -386,7 +386,7 @@
             }
 
             // Send data
-            $res = $this->_smtp->data("$textHeaders\r\n$body");
+            $res = $this->_smtp->data($body, $textHeaders);
             if (is_a($res, 'PEAR_Error')) {
                 $info = array('rcpt' => $rcpt);
                 return $this->_raiseError('failed_send_data', $info);
diff --git a/pear/mail/README.rst b/pear/mail/README.rst
new file mode 100644
index 0000000..9697e63
--- /dev/null
+++ b/pear/mail/README.rst
@@ -0,0 +1,53 @@
+****
+Mail
+****
+Class that provides multiple interfaces for sending emails.
+
+PEAR's Mail package defines an interface for implementing mailers under the
+PEAR hierarchy.
+It also provides supporting functions useful to multiple mailer backends.
+
+Currently supported backends include:
+
+- PHP's native ``mail()`` function
+- sendmail
+- SMTP
+
+This package also provides a `RFC 822`__ email address list validation utility 
class.
+
+Use Mail in combination with `Mail_Mime`__ to send HTML emails or emails with
+attachments - have a look at the example__.
+
+__ https://tools.ietf.org/html/rfc822
+__ http://pear.php.net/package/Mail_Mime
+__ http://pear.php.net/manual/en/package.mail.mail-mime.example.php
+
+============
+Installation
+============
+
+PEAR
+====
+::
+
+    $ pear install mail
+
+Composer
+========
+::
+
+    $ composer require pear/mail
+
+=====
+Links
+=====
+Homepage
+  http://pear.php.net/package/Mail
+Source code
+  https://github.com/pear/Mail
+Issue tracker
+  http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Mail
+Unit test status
+  https://travis-ci.org/pear/Mail
+Packagist
+  https://packagist.org/packages/pear/mail
diff --git a/pear/mail/composer.json b/pear/mail/composer.json
index 6eeacfa..4d398c9 100644
--- a/pear/mail/composer.json
+++ b/pear/mail/composer.json
@@ -34,6 +34,7 @@
     },
     "type": "library",
     "require": {
+        "php": ">=5.2.1",
         "pear/pear-core-minimal": "*"
     },
     "require-dev": {
diff --git a/pear/mail/package.xml b/pear/mail/package.xml
index 5a355da..e7f3a5e 100644
--- a/pear/mail/package.xml
+++ b/pear/mail/package.xml
@@ -16,11 +16,17 @@
   <email>rich...@phpguru.org</email>
   <active>yes</active>
  </developer>
- <date>2010-03-01</date>
- <time>22:16:48</time>
+ <developer>
+  <name>Aleksander Machniak</name>
+  <user>alec</user>
+  <email>a...@alec.pl</email>
+  <active>yes</active>
+ </developer>
+ <date>2016-01-31</date>
+ <time>21:00:00</time>
  <version>
-  <release>1.2.0</release>
-  <api>1.2.0</api>
+  <release>1.3.0</release>
+  <api>1.3.0</api>
  </version>
  <stability>
   <release>stable</release>
@@ -28,39 +34,46 @@
  </stability>
  <license uri="http://www.opensource.org/licenses/bsd-license.php";>BSD 
Style</license>
  <notes>
-QA release - stable.
+Added composer support.
 
-Updated minimum dependencies (Net_SMTP, PEAR, PHP)
-Doc Bug #15620 Licence change to BSD
-Bug #13659 Mail parse error in special condition
-Bug #16200 - Security hole allow to read/write Arbitrary File
-_hasUnclosedQuotes() doesn&apos;t properly handle a double slash before an end 
quote (slus...@curecanti.org, Bug #9137).
-Make sure Net_SMTP is defined when calling getSMTPObject() directly 
(slus...@curecanti.org, Bug #13772).
-Add addServiceExtensionParameter() to the SMTP driver (slus...@curecanti.org, 
Bug #13764).
-Add a method to obtain the Net_SMTP object from the SMTP driver 
(slus...@curecanti.org, Bug #13766).
+Added Travis CI test support.
+
+Updated code to use PHP 5 method signatures.
+
+Implemented requests:
+ * #17888, #17865: Reduce peak memory usage when using the smtp/smtpmx backend 
[alec]
+ * Ability to pass socket options to Net_SMTP
+
+Fixed bugs:
+ * #18109: New "pipelining" parameter for SMTP backend never used [alec]
+ * #17317: Invalid periods in mailbox not marked as invalid [alec]
+ * #17388: Deprecated assigning the return value of new by reference [alec]
+ * #17866, #20424, #12071, #17553: Non-static method 
Mail_RFC822::parseAddressList called statically [alec]
+ * #17178: Mail_RFC822::parseAddressList does not accept RFC-valid empty-group 
syntax [alec]
  </notes>
  <contents>
   <dir baseinstalldir="/" name="/">
-   <file baseinstalldir="/" md5sum="1aaa32cd73663461471b7c664bf1ddbb" 
name="Mail/mail.php" role="php" />
-   <file baseinstalldir="/" md5sum="b518286839921f8f0e6ee520374cc973" 
name="Mail/mock.php" role="php" />
-   <file baseinstalldir="/" md5sum="5f21af8a5d846e844ac7e525bcf2d8be" 
name="Mail/null.php" role="php" />
-   <file baseinstalldir="/" md5sum="2afca6e3415490de821b280b1e2cb0a6" 
name="Mail/RFC822.php" role="php" />
-   <file baseinstalldir="/" md5sum="b206391834f425f9a934b8f702b1847a" 
name="Mail/sendmail.php" role="php" />
-   <file baseinstalldir="/" md5sum="479aa21ec86e63e629db646ed292b142" 
name="Mail/smtp.php" role="php" />
-   <file baseinstalldir="/" md5sum="74e13bbc352601c9529c21e1e18f5b69" 
name="Mail/smtpmx.php" role="php" />
+   <file baseinstalldir="/" md5sum="311d8e436af49b7c07e6267811aa7ef0" 
name="Mail/mail.php" role="php" />
+   <file baseinstalldir="/" md5sum="374f3c31edbe16f9c3e869a0c501a03b" 
name="Mail/mock.php" role="php" />
+   <file baseinstalldir="/" md5sum="08dcb2a63e14dd967443c142182c1236" 
name="Mail/null.php" role="php" />
+   <file baseinstalldir="/" md5sum="4b464d31823e9b33949ac8b9970f87fc" 
name="Mail/RFC822.php" role="php" />
+   <file baseinstalldir="/" md5sum="01f6d47000e9a522fdeca4f00e74ca72" 
name="Mail/sendmail.php" role="php" />
+   <file baseinstalldir="/" md5sum="ad4480e29855a1b615ed412bc3d23073" 
name="Mail/smtp.php" role="php" />
+   <file baseinstalldir="/" md5sum="27376683d563ea16330866d5b8bea7e9" 
name="Mail/smtpmx.php" role="php" />
+   <file baseinstalldir="/" md5sum="c610cf314991e4d4ee82c6f4fd2e0fde" 
name="Mail.php" role="php" />
    <file baseinstalldir="/" md5sum="d66aa2a2f0bfe33f8a67d749a1a4d345" 
name="tests/9137.phpt" role="test" />
    <file baseinstalldir="/" md5sum="75d10361f686f1cc16637a9364e3eab7" 
name="tests/9137_2.phpt" role="test" />
-   <file baseinstalldir="/" md5sum="3659ceda2b94b66892869fa1ca12ada1" 
name="tests/13659.phpt" role="test" />
-   <file baseinstalldir="/" md5sum="bbd88a5dfb0536a8c66ba07a1fbda382" 
name="tests/rfc822.phpt" role="test" />
-   <file baseinstalldir="/" md5sum="4c8cad5cc0e546afee8c5e9d06f2cf03" 
name="tests/smtp_error.phpt" role="test" />
-   <file baseinstalldir="/" md5sum="fa4c53e482ff0c7af2bcbaffb090320c" 
name="tests/validateQuotedString.php" role="test" />
-   <file baseinstalldir="/" md5sum="89a692e0ae0ccc1a012559e5ea4d8a58" 
name="Mail.php" role="php" />
+   <file baseinstalldir="/" md5sum="73cec53118175c9bc1f487c70f8b86dc" 
name="tests/13659.phpt" role="test" />
+   <file baseinstalldir="/" md5sum="e99f00d8f07232e0f129dd77ae9699c7" 
name="tests/bug17178.phpt" role="test" />
+   <file baseinstalldir="/" md5sum="c2036980390981cd6b89c1e5c903913e" 
name="tests/bug17317.phpt" role="test" />
+   <file baseinstalldir="/" md5sum="7b0eae971fe7595e7c1a563fbfcfee90" 
name="tests/rfc822.phpt" role="test" />
+   <file baseinstalldir="/" md5sum="67becdb1027cefcb8dff1b691da630ab" 
name="tests/smtp_error.phpt" role="test" />
   </dir>
  </contents>
  <dependencies>
   <required>
    <php>
-    <min>4.4.9</min>
+    <min>5.2.1</min>
    </php>
    <pearinstaller>
     <min>1.5.6</min>
diff --git a/pear/mail/tests/13659.phpt b/pear/mail/tests/13659.phpt
index 51314ff..fa81a83 100644
--- a/pear/mail/tests/13659.phpt
+++ b/pear/mail/tests/13659.phpt
@@ -2,13 +2,13 @@
 Mail: Test for bug #13659
 --FILE--
 <?php
-
 //require_once dirname(__FILE__) . '/../Mail/RFC822.php';
 require_once 'Mail/RFC822.php';
 require_once 'PEAR.php';
 
 $address = '"Test Student" <t...@mydomain.com> (test)';
-$result = Mail_RFC822::parseAddressList($address, 'anydomain.com', TRUE); 
+$parser = new Mail_RFC822();
+$result = $parser->parseAddressList($address, 'anydomain.com', TRUE); 
 
 if (!PEAR::isError($result) && is_array($result) && is_object($result[0]))
     if ($result[0]->personal == '"Test Student"' &&
diff --git a/pear/mail/tests/Makefile b/pear/mail/tests/Makefile
new file mode 100644
index 0000000..bb6b1be
--- /dev/null
+++ b/pear/mail/tests/Makefile
@@ -0,0 +1,8 @@
+
+clean:
+       rm -f *.log *.php *.diff *.exp *.out
+
+
+
+test:
+       cd .. && pear run-tests tests/*.phpt && cd tests;
diff --git a/pear/mail/tests/bug17178.phpt b/pear/mail/tests/bug17178.phpt
new file mode 100755
index 0000000..4572dda
--- /dev/null
+++ b/pear/mail/tests/bug17178.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Mail_RFC822::parseAddressList does not accept RFC-valid group syntax
+--FILE--
+<?php
+require "Mail/RFC822.php";
+
+var_dump(Mail_RFC822::parseAddressList("empty-group:;","invalid",false,false));
 
+
+--EXPECT--
+array(0) {
+} 
diff --git a/pear/mail/tests/bug17317.phpt b/pear/mail/tests/bug17317.phpt
new file mode 100755
index 0000000..331e803
--- /dev/null
+++ b/pear/mail/tests/bug17317.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Mail_RFC822::parseAddressList invalid periods in mail address
+--FILE--
+<?php
+require "Mail/RFC822.php";
+
+$result[] = Mail_RFC822::parseAddressList('.n...@example.com');
+$result[] = Mail_RFC822::parseAddressList('na...@example.com');
+$result[] = Mail_RFC822::parseAddressList('name..n...@example.com');
+
+foreach ($result as $r) {
+    if (is_a($r, 'PEAR_Error')) {
+        echo "OK\n";
+    }
+}
+--EXPECT--
+OK
+OK
+OK
diff --git a/pear/mail/tests/rfc822.phpt b/pear/mail/tests/rfc822.phpt
index 71261ff..5ba8e3c 100644
--- a/pear/mail/tests/rfc822.phpt
+++ b/pear/mail/tests/rfc822.phpt
@@ -4,7 +4,7 @@
 <?php
 require_once 'Mail/RFC822.php';
 
-$parser = &new Mail_RFC822();
+$parser = new Mail_RFC822();
 
 /* A simple, bare address. */
 $address = 'u...@example.com';
diff --git a/pear/mail/tests/smtp_error.phpt b/pear/mail/tests/smtp_error.phpt
index 00c9e1d..4e8e5a6 100644
--- a/pear/mail/tests/smtp_error.phpt
+++ b/pear/mail/tests/smtp_error.phpt
@@ -4,7 +4,7 @@
 <?php
 
 require_once 'PEAR/Registry.php';
-$registry = &new PEAR_Registry();
+$registry = new PEAR_Registry();
 
 if (!$registry->packageExists('Net_SMTP')) die("skip\n");
 --FILE--
@@ -15,13 +15,16 @@
 $params = array('host' => 'bogus.host.tld');
 
 /* Create our SMTP-based mailer object. */
-$mailer = &Mail::factory('smtp', $params);
+$mailer = Mail::factory('smtp', $params);
 
 /* Attempt to send an empty message in order to trigger an error. */
 $e = $mailer->send(array(), array(), '');
 if (is_a($e, 'PEAR_Error')) {
-    die($e->getMessage() . "\n");
+     $err = $e->getMessage();
+     if (preg_match('/Failed to connect to bogus.host.tld:25 \[SMTP: Failed to 
connect socket:.*/i', $err)) {
+        echo "OK";
+     }
 }
 
 --EXPECT--
-Failed to connect to bogus.host.tld:25 [SMTP: Failed to connect socket:  
(code: -1, response: )]
+OK
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/268899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabeda04aa1194aca5e797dcf90b0ad9b480d3402
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vendor
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to