Fix PHP 7.2 warnings on count() use (#5845)

pull/5847/head
Aleksander Machniak 7 years ago
parent 97bf251dc6
commit e04f72d018

@ -41,6 +41,7 @@ CHANGELOG Roundcube Webmail
- Fix position of selected icon for (Mailvelope) Encrypt button - Fix position of selected icon for (Mailvelope) Encrypt button
- Fix fatal error when using DMY- or MDY-based date format in PostgreSQL (#5808) - Fix fatal error when using DMY- or MDY-based date format in PostgreSQL (#5808)
- Fix bug where errors were not printed when using bin/update.sh (#5834) - Fix bug where errors were not printed when using bin/update.sh (#5834)
- Fix PHP 7.2 warnings on count() use (#5845)
RELEASE 1.3.0 RELEASE 1.3.0
------------- -------------

@ -364,7 +364,7 @@ class rcube_contacts extends rcube_addressbook
// count result pages // count result pages
$cnt = $this->count()->count; $cnt = $this->count()->count;
$pages = ceil($cnt / $this->page_size); $pages = ceil($cnt / $this->page_size);
$scnt = count($post_search); $scnt = !empty($post_search) ? count($post_search) : 0;
// get (paged) result // get (paged) result
for ($i=0; $i<$pages; $i++) { for ($i=0; $i<$pages; $i++) {

@ -133,7 +133,7 @@ class rcube_db_oracle extends rcube_db
$idx = 0; $idx = 0;
$args = array(); $args = array();
if (count($params)) { if (!empty($params)) {
while ($pos = strpos($query, '?', $pos)) { while ($pos = strpos($query, '?', $pos)) {
if ($query[$pos+1] == '?') { // skip escaped '?' if ($query[$pos+1] == '?') { // skip escaped '?'
$pos += 2; $pos += 2;

@ -1250,7 +1250,7 @@ class rcube_imap_generic
} }
list($code, $response) = $this->execute('STATUS', array($this->escape($mailbox), list($code, $response) = $this->execute('STATUS', array($this->escape($mailbox),
'(' . implode(' ', (array) $items) . ')')); '(' . implode(' ', $items) . ')'));
if ($code == self::ERROR_OK && preg_match('/^\* STATUS /i', $response)) { if ($code == self::ERROR_OK && preg_match('/^\* STATUS /i', $response)) {
$result = array(); $result = array();
@ -1263,10 +1263,10 @@ class rcube_imap_generic
if (!is_array($items) && ($pos = strpos($response, '(')) !== false) { if (!is_array($items) && ($pos = strpos($response, '(')) !== false) {
$response = substr($response, $pos); $response = substr($response, $pos);
$items = $this->tokenizeResponse($response, 1); $items = $this->tokenizeResponse($response, 1);
}
if (!is_array($items)) { if (!is_array($items)) {
return $result; return $result;
}
} }
for ($i=0, $len=count($items); $i<$len; $i += 2) { for ($i=0, $len=count($items); $i<$len; $i += 2) {

@ -435,14 +435,16 @@ class rcube_plugin_api
array_push($this->exec_stack, $hook); array_push($this->exec_stack, $hook);
// Use for loop here, so handlers added in the hook will be executed too // Use for loop here, so handlers added in the hook will be executed too
for ($i = 0; $i < count($this->handlers[$hook]); $i++) { if (!empty($this->handlers[$hook])) {
$ret = call_user_func($this->handlers[$hook][$i], $args); for ($i = 0; $i < count($this->handlers[$hook]); $i++) {
if ($ret && is_array($ret)) { $ret = call_user_func($this->handlers[$hook][$i], $args);
$args = $ret + $args; if ($ret && is_array($ret)) {
} $args = $ret + $args;
}
if ($args['break']) { if ($args['break']) {
break; break;
}
} }
} }

@ -27,10 +27,10 @@
*/ */
class rcube_result_set implements Iterator, ArrayAccess class rcube_result_set implements Iterator, ArrayAccess
{ {
public $count = 0; public $count = 0;
public $first = 0; public $first = 0;
public $searchonly = false; public $searchonly = false;
public $records = array(); public $records = array();
private $current = 0; private $current = 0;

Loading…
Cancel
Save