-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 7.2 support #10
PHP 7.2 support #10
Changes from all commits
71ba4fa
3e0edb8
66f2472
dcb9205
4e54d06
8c8baf4
d6588d9
8ec9c8c
92af96f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,3 @@ script: | |
|
||
matrix: | ||
allow_failures: | ||
- php: 7.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,7 +202,7 @@ public function __construct($yaml, $section = null, $options = false) | |
if (!isset($config[$sectionName])) { | ||
require_once 'Zend/Config/Exception.php'; | ||
throw new Zend_Config_Exception(sprintf( | ||
'Section "%s" cannot be found', | ||
'Section "%s" cannot be found', | ||
implode(' ', (array)$section) | ||
)); | ||
} | ||
|
@@ -214,7 +214,7 @@ public function __construct($yaml, $section = null, $options = false) | |
if (!isset($config[$section])) { | ||
require_once 'Zend/Config/Exception.php'; | ||
throw new Zend_Config_Exception(sprintf( | ||
'Section "%s" cannot be found', | ||
'Section "%s" cannot be found', | ||
implode(' ', (array)$section) | ||
)); | ||
} | ||
|
@@ -289,8 +289,10 @@ protected static function _decodeYaml($currentIndent, &$lines) | |
{ | ||
$config = array(); | ||
$inIndent = false; | ||
while (list($n, $line) = each($lines)) { | ||
$lineno = $n + 1; | ||
while (key($lines) !== null) { | ||
$line = current($lines); | ||
$lineno = key($lines) + 1; | ||
next($lines); | ||
|
||
$line = rtrim(preg_replace("/#.*$/", "", $line)); | ||
if (strlen($line) == 0) { | ||
|
@@ -363,10 +365,10 @@ protected static function _parseValue($value) | |
|
||
// remove quotes from string. | ||
if ('"' == $value['0']) { | ||
if ('"' == $value[count($value) -1]) { | ||
if ('"' == $value[strlen($value) -1]) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably a long-standing bug, since |
||
$value = substr($value, 1, -1); | ||
} | ||
} elseif ('\'' == $value['0'] && '\'' == $value[count($value) -1]) { | ||
} elseif ('\'' == $value['0'] && '\'' == $value[strlen($value) -1]) { | ||
$value = strtr($value, array("''" => "'", "'" => '')); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1304,13 +1304,13 @@ public function find() | |
$whereList = array(); | ||
$numberTerms = 0; | ||
foreach ($args as $keyPosition => $keyValues) { | ||
$keyValuesCount = count($keyValues); | ||
// Coerce the values to an array. | ||
// Don't simply typecast to array, because the values | ||
// might be Zend_Db_Expr objects. | ||
if (!is_array($keyValues)) { | ||
$keyValues = array($keyValues); | ||
} | ||
$keyValuesCount = count($keyValues); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seemed safe to move this down a bit, so |
||
if ($numberTerms == 0) { | ||
$numberTerms = $keyValuesCount; | ||
} else if ($keyValuesCount != $numberTerms) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,7 @@ public function getAuthors() | |
); | ||
} | ||
|
||
if (count($authors) == 0) { | ||
if ($authors !== null && count($authors) == 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the tests |
||
$authors = null; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ | |
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface | ||
class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface, Countable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests run The specific test doing this was counting the object to make sure there were no parts. |
||
{ | ||
/** | ||
* headers of part as array | ||
|
@@ -96,10 +96,10 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface | |
* @var int | ||
*/ | ||
protected $_messageNum = 0; | ||
|
||
/** | ||
* Class to use when creating message parts | ||
* @var string | ||
* @var string | ||
*/ | ||
protected $_partClass; | ||
|
||
|
@@ -138,7 +138,7 @@ public function __construct(array $params) | |
$this->_mail = $params['handler']; | ||
$this->_messageNum = $params['id']; | ||
} | ||
|
||
if (isset($params['partclass'])) { | ||
$this->setPartClass($params['partclass']); | ||
} | ||
|
@@ -162,7 +162,7 @@ public function __construct(array $params) | |
} | ||
} | ||
} | ||
|
||
/** | ||
* Set name pf class used to encapsulate message parts | ||
* @param string $class | ||
|
@@ -184,14 +184,14 @@ public function setPartClass($class) | |
require_once 'Zend/Mail/Exception.php'; | ||
throw new Zend_Mail_Exception("Class '{$class}' must implement Zend_Mail_Part_Interface"); | ||
} | ||
|
||
$this->_partClass = $class; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Retrieve the class name used to encapsulate message parts | ||
* @return string | ||
* @return string | ||
*/ | ||
public function getPartClass() | ||
{ | ||
|
@@ -579,6 +579,11 @@ public function rewind() | |
$this->_iterationPos = 1; | ||
} | ||
|
||
public function count() | ||
{ | ||
return $this->countParts(); | ||
} | ||
|
||
/** | ||
* Ensure headers do not contain invalid characters | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ public function __construct( | |
if ($response !== null) { | ||
$this->_response = $response; | ||
$params = $this->_parseParameters($response); | ||
if (count($params) > 0) { | ||
if ($params !== null && count($params) > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$this->setParams($params); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,11 @@ public function setRowCount($rowCount) | |
*/ | ||
public function append($row) | ||
{ | ||
$this->_columnCount = count($row); | ||
if (!is_array($row)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$this->_columnCount = 1; | ||
} else { | ||
$this->_columnCount = count($row); | ||
} | ||
$this->_fetchStack[] = $row; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,7 +383,7 @@ public function valid() | |
*/ | ||
public function hasChildren() | ||
{ | ||
return (count($this->_subResources > 0)) ? true : false; | ||
return (count($this->_subResources) > 0) ? true : false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a type-o, but since it would have been counting |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -453,7 +453,7 @@ private function _validateMXRecords() | |
|
||
//decode IDN domain name if possible | ||
if (function_exists('idn_to_ascii')) { | ||
$hostname = idn_to_ascii($this->_hostname); | ||
$hostname = idn_to_ascii($this->_hostname, 0, INTL_IDNA_VARIANT_UTS46); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a test throwing a deprecation notice (but not failing) because of this. The default constant used to this function (if not specified) is
The |
||
} | ||
|
||
$result = getmxrr($hostname, $mxHosts); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -486,13 +486,17 @@ protected static function _createSimpleXMLElement(&$xml) | |
*/ | ||
protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$value) | ||
{ | ||
list($type, $value) = each($xml); | ||
$type = key($xml); | ||
$value = current($xml); | ||
next($xml); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These lines should mimic the old |
||
|
||
if (!$type and $value === null) { | ||
if ($type === null && $value === false) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the two values that would be set if |
||
$namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions'); | ||
foreach ($namespaces as $namespaceName => $namespaceUri) { | ||
$namespaceXml = $xml->children($namespaceUri); | ||
list($type, $value) = each($namespaceXml); | ||
$type = key($namespaceXml); | ||
$value = current($namespaceXml); | ||
next($namespaceXml); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to above. |
||
if ($type !== null) { | ||
$type = $namespaceName . ':' . $type; | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple
foreach
was not possible here because the position of the array pointer is important (both internal to this function (due to theprev
used below) and external to this function (since$lines
is passed by reference)).