On 17.06.2016 [14:17:49 +0200], Mathieu Parent wrote: > Control: tag -1 + confirmed + upstream - patch > Control: reassign -1 + php-seclib 1.0.2-1 > Control: affects -1 + php-horde-mapi > > > 2016-06-16 23:09 GMT+02:00 Nishanth Aravamudan > <nish.aravamu...@canonical.com>: > > Package: php-horde-mapi > > Version: 1.0.8-2 > > Severity: wishlist > > Tags: patch > > User: ubuntu-de...@lists.ubuntu.com > > Usertags: origin-ubuntu yakkety ubuntu-patch > > > > Dear Maintainer, > > > > autopkgtests in Debian and Ubuntu are failing, due to a deprecation > > warning being emitted on stderr during the test. > > > > In Ubuntu, the attached patch was applied to achieve the following: > > > > * d/tests/control: allow stderr output, as deprecated warnings from > > BigInteger are reported with PHP7.0 (LP: #1593003). > > > > Thanks for considering the patch. > > Hello Nishanth, > > Thanks for the patch. I won't merge it, can you fix php-seclib instead > (while not re-introducing #819420)?
I am happy to try! It seems like the attached patch should do it at least for all the php-seclib code. I'm not sure there's a way to audit all source files in Debian that might include a PHP file from php-seclib and then define a class and not use the non-deprecated constructor syntax?
Description: Fix "Methods with the same name as their class" deprecation PHP7 emits a deprecation warning for any class using a same-named function as a constructor (it should be __construct). Fix phpseclib to be internally consistent with this requirement. Author: Nishanth Aravamudan <nish.aravamu...@canonical.com> Bug-Debian: https://bugs.debian.org/827483 --- phpseclib-1.0.2.orig/phpseclib/Crypt/Base.php +++ phpseclib-1.0.2/phpseclib/Crypt/Base.php @@ -97,7 +97,7 @@ define('CRYPT_MODE_STREAM', 5); /**#@+ * @access private - * @see self::Crypt_Base() + * @see self::__construct() * @internal These constants are for internal use only */ /** @@ -127,7 +127,7 @@ class Crypt_Base /** * The Encryption Mode * - * @see self::Crypt_Base() + * @see self::__construct() * @var int * @access private */ @@ -316,7 +316,7 @@ class Crypt_Base /** * Is the mode one that is paddable? * - * @see self::Crypt_Base() + * @see self::__construct() * @var bool * @access private */ @@ -411,7 +411,7 @@ class Crypt_Base * $aes = new Crypt_AES(CRYPT_AES_MODE_CFB); // $aes will operate in cfb mode * $aes = new Crypt_AES(CRYPT_MODE_CFB); // identical * - * @see self::Crypt_Base() + * @see self::__construct() * @var string * @access private */ @@ -503,7 +503,7 @@ class Crypt_Base * @param int $mode * @access public */ - function Crypt_Base($mode = CRYPT_MODE_CBC) + function __construct($mode = CRYPT_MODE_CBC) { // $mode dependent settings switch ($mode) { @@ -1587,7 +1587,7 @@ class Crypt_Base /** * Test for engine validity * - * @see self::Crypt_Base() + * @see self::__construct() * @param int $engine * @access public * @return bool @@ -1654,7 +1654,7 @@ class Crypt_Base * * If the preferred crypt engine is not available the fastest available one will be used * - * @see self::Crypt_Base() + * @see self::__construct() * @param int $engine * @access public */ @@ -1687,7 +1687,7 @@ class Crypt_Base /** * Sets the engine as appropriate * - * @see self::Crypt_Base() + * @see self::__construct() * @access private */ function _setEngine() --- phpseclib-1.0.2.orig/phpseclib/Crypt/Hash.php +++ phpseclib-1.0.2/phpseclib/Crypt/Hash.php @@ -56,7 +56,7 @@ /**#@+ * @access private - * @see self::Crypt_Hash() + * @see self::__construct() */ /** * Toggles the internal implementation @@ -151,7 +151,7 @@ class Crypt_Hash * @return Crypt_Hash * @access public */ - function Crypt_Hash($hash = 'sha1') + function __construct($hash = 'sha1') { if (!defined('CRYPT_HASH_MODE')) { switch (true) { --- phpseclib-1.0.2.orig/phpseclib/Crypt/RC2.php +++ phpseclib-1.0.2/phpseclib/Crypt/RC2.php @@ -351,13 +351,13 @@ class Crypt_RC2 extends Crypt_Base * * If not explicitly set, CRYPT_RC2_MODE_CBC will be used. * - * @see Crypt_Base::Crypt_Base() + * @see Crypt_Base::__construct() * @param int $mode * @access public */ - function Crypt_RC2($mode = CRYPT_RC2_MODE_CBC) + function __construct($mode = CRYPT_RC2_MODE_CBC) { - parent::Crypt_Base($mode); + parent::__construct($mode); } /** @@ -365,7 +365,7 @@ class Crypt_RC2 extends Crypt_Base * * This is mainly just a wrapper to set things up for Crypt_Base::isValidEngine() * - * @see Crypt_Base::Crypt_Base() + * @see Crypt_Base::__construct() * @param int $engine * @access public * @return bool --- phpseclib-1.0.2.orig/phpseclib/Crypt/RC4.php +++ phpseclib-1.0.2/phpseclib/Crypt/RC4.php @@ -157,13 +157,13 @@ class Crypt_RC4 extends Crypt_Base * * Determines whether or not the mcrypt extension should be used. * - * @see Crypt_Base::Crypt_Base() + * @see Crypt_Base::__construct() * @return Crypt_RC4 * @access public */ - function Crypt_RC4() + function __construct() { - parent::Crypt_Base(CRYPT_MODE_STREAM); + parent::__construct(CRYPT_MODE_STREAM); } /** --- phpseclib-1.0.2.orig/phpseclib/Crypt/RSA.php +++ phpseclib-1.0.2/phpseclib/Crypt/RSA.php @@ -168,7 +168,7 @@ define('CRYPT_RSA_ASN1_SEQUENCE', 48); /**#@+ * @access private - * @see self::Crypt_RSA() + * @see self::__construct() */ /** * To use the pure-PHP implementation @@ -491,7 +491,7 @@ class Crypt_RSA * @return Crypt_RSA * @access public */ - function Crypt_RSA() + function __construct() { if (!class_exists('Math_BigInteger')) { include_once 'Math/BigInteger.php'; --- phpseclib-1.0.2.orig/phpseclib/Crypt/Rijndael.php +++ phpseclib-1.0.2/phpseclib/Crypt/Rijndael.php @@ -260,13 +260,13 @@ class Crypt_Rijndael extends Crypt_Base * * If not explictly set, CRYPT_RIJNDAEL_MODE_CBC will be used. * - * @see Crypt_Base::Crypt_Base() + * @see Crypt_Base::__construct() * @param int $mode * @access public */ - function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC) + function __construct($mode = CRYPT_RIJNDAEL_MODE_CBC) { - parent::Crypt_Base($mode); + parent::__construct($mode); } /** --- phpseclib-1.0.2.orig/phpseclib/Crypt/TripleDES.php +++ phpseclib-1.0.2/phpseclib/Crypt/TripleDES.php @@ -61,7 +61,7 @@ if (!class_exists('Crypt_DES')) { /**#@+ * @access public - * @see self::Crypt_TripleDES() + * @see self::__construct() */ /** * Encrypt / decrypt using inner chaining @@ -191,18 +191,18 @@ class Crypt_TripleDES extends Crypt_DES * * If not explicitly set, CRYPT_DES_MODE_CBC will be used. * - * @see Crypt_DES::Crypt_DES() - * @see Crypt_Base::Crypt_Base() + * @see Crypt_DES::__construct() + * @see Crypt_Base::__construct() * @param int $mode * @access public */ - function Crypt_TripleDES($mode = CRYPT_MODE_CBC) + function __construct($mode = CRYPT_MODE_CBC) { switch ($mode) { // In case of CRYPT_DES_MODE_3CBC, we init as CRYPT_DES_MODE_CBC // and additional flag us internally as 3CBC case CRYPT_DES_MODE_3CBC: - parent::Crypt_Base(CRYPT_MODE_CBC); + parent::__construct(CRYPT_MODE_CBC); $this->mode_3cbc = true; // This three $des'es will do the 3CBC work (if $key > 64bits) @@ -219,7 +219,7 @@ class Crypt_TripleDES extends Crypt_DES break; // If not 3CBC, we init as usual default: - parent::Crypt_Base($mode); + parent::__construct($mode); } } --- phpseclib-1.0.2.orig/phpseclib/File/ANSI.php +++ phpseclib-1.0.2/phpseclib/File/ANSI.php @@ -179,7 +179,7 @@ class File_ANSI * @return File_ANSI * @access public */ - function File_ANSI() + function __construct() { $attr_cell = new stdClass(); $attr_cell->bold = false; --- phpseclib-1.0.2.orig/phpseclib/File/ASN1.php +++ phpseclib-1.0.2/phpseclib/File/ASN1.php @@ -131,7 +131,7 @@ class File_ASN1_Element * @return File_ASN1_Element * @access public */ - function File_ASN1_Element($encoded) + function __construct($encoded) { $this->element = $encoded; } @@ -245,7 +245,7 @@ class File_ASN1 * * @access public */ - function File_ASN1() + function __construct() { static $static_init = null; if (!$static_init) { --- phpseclib-1.0.2.orig/phpseclib/File/X509.php +++ phpseclib-1.0.2/phpseclib/File/X509.php @@ -317,7 +317,7 @@ class File_X509 * @return File_X509 * @access public */ - function File_X509() + function __construct() { if (!class_exists('Math_BigInteger')) { include_once 'Math/BigInteger.php'; --- phpseclib-1.0.2.orig/phpseclib/Math/BigInteger.php +++ phpseclib-1.0.2/phpseclib/Math/BigInteger.php @@ -136,7 +136,7 @@ define('MATH_BIGINTEGER_DATA', 1); * Mode constants. * * @access private - * @see self::Math_BigInteger() + * @see self::__construct() */ /** * To use the pure-PHP implementation @@ -243,7 +243,7 @@ class Math_BigInteger * @return Math_BigInteger * @access public */ - function Math_BigInteger($x = 0, $base = 10) + function __construct($x = 0, $base = 10) { if (!defined('MATH_BIGINTEGER_MODE')) { switch (true) { --- phpseclib-1.0.2.orig/phpseclib/Net/SCP.php +++ phpseclib-1.0.2/phpseclib/Net/SCP.php @@ -122,7 +122,7 @@ class Net_SCP * @return Net_SCP * @access public */ - function Net_SCP($ssh) + function __construct($ssh) { if (!is_object($ssh)) { return; --- phpseclib-1.0.2.orig/phpseclib/Net/SFTP.php +++ phpseclib-1.0.2/phpseclib/Net/SFTP.php @@ -129,7 +129,7 @@ class Net_SFTP extends Net_SSH2 /** * Packet Types * - * @see self::Net_SFTP() + * @see self::__construct() * @var array * @access private */ @@ -138,7 +138,7 @@ class Net_SFTP extends Net_SSH2 /** * Status Codes * - * @see self::Net_SFTP() + * @see self::__construct() * @var array * @access private */ @@ -250,7 +250,7 @@ class Net_SFTP extends Net_SSH2 /** * Max SFTP Packet Size * - * @see self::Net_SFTP() + * @see self::__construct() * @see self::get() * @var array * @access private @@ -288,9 +288,9 @@ class Net_SFTP extends Net_SSH2 * @return Net_SFTP * @access public */ - function Net_SFTP($host, $port = 22, $timeout = 10) + function __construct($host, $port = 22, $timeout = 10) { - parent::Net_SSH2($host, $port, $timeout); + parent::__construct($host, $port, $timeout); $this->max_sftp_packet = 1 << 15; --- phpseclib-1.0.2.orig/phpseclib/Net/SFTP/Stream.php +++ phpseclib-1.0.2/phpseclib/Net/SFTP/Stream.php @@ -146,7 +146,7 @@ class Net_SFTP_Stream * * @access public */ - function Net_SFTP_Stream() + function __construct() { if (defined('NET_SFTP_STREAM_LOGGING')) { echo "__construct()\r\n"; --- phpseclib-1.0.2.orig/phpseclib/Net/SSH1.php +++ phpseclib-1.0.2/phpseclib/Net/SSH1.php @@ -358,7 +358,7 @@ class Net_SSH1 /** * Protocol Flags * - * @see self::Net_SSH1() + * @see self::__construct() * @var array * @access private */ @@ -461,7 +461,7 @@ class Net_SSH1 /** * Hostname * - * @see self::Net_SSH1() + * @see self::__construct() * @see self::_connect() * @var string * @access private @@ -471,7 +471,7 @@ class Net_SSH1 /** * Port Number * - * @see self::Net_SSH1() + * @see self::__construct() * @see self::_connect() * @var int * @access private @@ -486,7 +486,7 @@ class Net_SSH1 * however, is non-optional. There will be a timeout, whether or not you set it. If you don't it'll be * 10 seconds. It is used by fsockopen() in that function. * - * @see self::Net_SSH1() + * @see self::__construct() * @see self::_connect() * @var int * @access private @@ -496,7 +496,7 @@ class Net_SSH1 /** * Default cipher * - * @see self::Net_SSH1() + * @see self::__construct() * @see self::_connect() * @var int * @access private @@ -515,7 +515,7 @@ class Net_SSH1 * @return Net_SSH1 * @access public */ - function Net_SSH1($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) + function __construct($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) { if (!class_exists('Math_BigInteger')) { include_once 'Math/BigInteger.php'; @@ -1336,7 +1336,7 @@ class Net_SSH1 * should be a number with the property that gcd($e, ($p - 1) * ($q - 1)) == 1. Could just make anything that * calls this call modexp, instead, but I think this makes things clearer, maybe... * - * @see self::Net_SSH1() + * @see self::__construct() * @param Math_BigInteger $m * @param array $key * @return Math_BigInteger --- phpseclib-1.0.2.orig/phpseclib/Net/SSH2.php +++ phpseclib-1.0.2/phpseclib/Net/SSH2.php @@ -324,7 +324,7 @@ class Net_SSH2 * * -- http://tools.ietf.org/html/rfc4253#section-6 * - * @see self::Net_SSH2() + * @see self::__construct() * @see self::_send_binary_packet() * @var int * @access private @@ -334,7 +334,7 @@ class Net_SSH2 /** * Block Size for Client to Server Encryption * - * @see self::Net_SSH2() + * @see self::__construct() * @see self::_get_binary_packet() * @var int * @access private @@ -428,7 +428,7 @@ class Net_SSH2 /** * Message Numbers * - * @see self::Net_SSH2() + * @see self::__construct() * @var array * @access private */ @@ -437,7 +437,7 @@ class Net_SSH2 /** * Disconnection Message 'reason codes' defined in RFC4253 * - * @see self::Net_SSH2() + * @see self::__construct() * @var array * @access private */ @@ -446,7 +446,7 @@ class Net_SSH2 /** * SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254 * - * @see self::Net_SSH2() + * @see self::__construct() * @var array * @access private */ @@ -456,7 +456,7 @@ class Net_SSH2 * Terminal Modes * * @link http://tools.ietf.org/html/rfc4254#section-8 - * @see self::Net_SSH2() + * @see self::__construct() * @var array * @access private */ @@ -466,7 +466,7 @@ class Net_SSH2 * SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes * * @link http://tools.ietf.org/html/rfc4254#section-5.2 - * @see self::Net_SSH2() + * @see self::__construct() * @var array * @access private */ @@ -814,7 +814,7 @@ class Net_SSH2 /** * Hostname * - * @see self::Net_SSH2() + * @see self::__construct() * @see self::_connect() * @var string * @access private @@ -824,7 +824,7 @@ class Net_SSH2 /** * Port Number * - * @see self::Net_SSH2() + * @see self::__construct() * @see self::_connect() * @var int * @access private @@ -883,7 +883,7 @@ class Net_SSH2 * @return Net_SSH2 * @access public */ - function Net_SSH2($host, $port = 22, $timeout = 10) + function __construct($host, $port = 22, $timeout = 10) { // Include Math_BigInteger // Used to do Diffie-Hellman key exchange and DSA/RSA signature verification. --- phpseclib-1.0.2.orig/phpseclib/System/SSH/Agent.php +++ phpseclib-1.0.2/phpseclib/System/SSH/Agent.php @@ -130,7 +130,7 @@ class System_SSH_Agent_Identity * @return System_SSH_Agent_Identity * @access private */ - function System_SSH_Agent_Identity($fsock) + function __construct($fsock) { $this->fsock = $fsock; } @@ -269,7 +269,7 @@ class System_SSH_Agent * @return System_SSH_Agent * @access public */ - function System_SSH_Agent() + function __construct() { switch (true) { case isset($_SERVER['SSH_AUTH_SOCK']):