Aleksander Machniak
2015-08-07 1b39d9a6c744a393e7930c2493cc2ddc9c9e95bf
PHP7: Fixed some E_WARNING errors that previously were E_STRICT
4 files added
12 files modified
138 ■■■■ changed files
bin/deluser.sh 2 ●●● patch | view | raw | blame | history
index.php 2 ●●● patch | view | raw | blame | history
plugins/example_addressbook/example_addressbook_backend.php 4 ●●●● patch | view | raw | blame | history
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php 4 ●●● patch | view | raw | blame | history
program/include/rcmail.php 10 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube.php 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_content_filter.php 2 ●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_ldap.php 9 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_ldap_generic.php 8 ●●●●● patch | view | raw | blame | history
tests/Framework/DBOracle.php 22 ●●●●● patch | view | raw | blame | history
tests/Framework/ImapSearch.php 20 ●●●●● patch | view | raw | blame | history
tests/Framework/Ldap.php 23 ●●●●● patch | view | raw | blame | history
tests/Framework/ResultMultifolder.php 20 ●●●●● patch | view | raw | blame | history
tests/Selenium/bootstrap.php 2 ●●● patch | view | raw | blame | history
tests/bootstrap.php 2 ●●● patch | view | raw | blame | history
tests/phpunit.xml 4 ●●●● patch | view | raw | blame | history
bin/deluser.sh
@@ -37,7 +37,7 @@
    exit(1);
}
$rcmail = rcmail::get_instance();
$rcmail = rcube::get_instance();
// get arguments
$args     = rcube_utils::get_opt(array('h' => 'host'));
index.php
@@ -40,7 +40,7 @@
require_once 'program/include/iniset.php';
// init application, start session, init output class, etc.
$RCMAIL = rcmail::get_instance($GLOBALS['env']);
$RCMAIL = rcmail::get_instance(0, $GLOBALS['env']);
// Make the whole PHP output non-cacheable (#1487797)
$RCMAIL->output->nocacheing_headers();
plugins/example_addressbook/example_addressbook_backend.php
@@ -44,7 +44,7 @@
    $this->filter = null;
  }
  function list_groups($search = null)
  function list_groups($search = null, $mode = 0)
  {
    return array(
      array('ID' => 'testgroup1', 'name' => "Testgroup"),
@@ -98,7 +98,7 @@
    return false;
  }
  function rename_group($gid, $newname)
  function rename_group($gid, $newname, &$newid)
  {
    return $newname;
  }
plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
@@ -49,9 +49,11 @@
    /**
     * Find and load sieve script with/for vacation rule
     *
     * @param string $script_name Optional script name
     *
     * @return int Connection status: 0 on success, >0 on failure
     */
    protected function load_script()
    protected function load_script($script_name = null)
    {
        if ($this->script_name !== null) {
            return 0;
program/include/rcmail.php
@@ -65,11 +65,12 @@
    /**
     * This implements the 'singleton' design pattern
     *
     * @param string Environment name to run (e.g. live, dev, test)
     * @param integer $mode Ignored rcube::get_instance() argument
     * @param string  $env  Environment name to run (e.g. live, dev, test)
     *
     * @return rcmail The one and only instance
     */
    static function get_instance($env = '')
    static function get_instance($mode = 0, $env = '')
    {
        if (!self::$instance || !is_a(self::$instance, 'rcmail')) {
            self::$instance = new rcmail($env);
@@ -94,8 +95,9 @@
        }
        // load all configured plugins
        $this->plugins->load_plugins((array)$this->config->get('plugins', array()),
                                     array('filesystem_attachments', 'jqueryui'));
        $plugins          = (array) $this->config->get('plugins', array());
        $required_plugins = array('filesystem_attachments', 'jqueryui');
        $this->plugins->load_plugins($plugins, $required_plugins);
        // start session
        $this->session_init();
program/lib/Roundcube/rcube.php
@@ -124,8 +124,8 @@
    /**
     * This implements the 'singleton' design pattern
     *
     * @param integer Options to initialize with this instance. See rcube::INIT_WITH_* constants
     * @param string Environment name to run (e.g. live, dev, test)
     * @param integer $mode Options to initialize with this instance. See rcube::INIT_WITH_* constants
     * @param string  $env  Environment name to run (e.g. live, dev, test)
     *
     * @return rcube The one and only instance
     */
program/lib/Roundcube/rcube_content_filter.php
@@ -33,7 +33,7 @@
        return true;
    }
    function filter($in, $out, &$consumed)
    function filter($in, $out, &$consumed, $closing)
    {
        while ($bucket = stream_bucket_make_writeable($in)) {
            $this->buffer .= $bucket->data;
program/lib/Roundcube/rcube_ldap.php
@@ -1051,11 +1051,14 @@
    /**
     * Create a new contact record
     *
     * @param array    Hash array with save data
     * @param array Associative array with save data
     *  Keys:   Field name with optional section in the form FIELD:SECTION
     *  Values: Field value. Can be either a string or an array of strings for multiple values
     * @param boolean True to check for duplicates first
     *
     * @return encoded record ID on success, False on error
     * @return mixed The created record ID on success, False on error
     */
    function insert($save_cols)
    function insert($save_cols, $check = false)
    {
        // Map out the column names to their LDAP ones to build the new entry.
        $newentry = $this->_map_data($save_cols);
program/lib/Roundcube/rcube_ldap_generic.php
@@ -57,12 +57,13 @@
     * Get a specific LDAP entry, identified by its DN
     *
     * @param string $dn Record identifier
     * @param array  $attributes Attributes to return
     *
     * @return array Hash array
     */
    function get_entry($dn)
    function get_entry($dn, $attributes = array())
    {
        return parent::get_entry($dn, $this->attributes);
        return parent::get_entry($dn, !empty($attributes) ? $attributes : $this->attributes);
    }
    /**
@@ -284,10 +285,11 @@
     * Turn an LDAP entry into a regular PHP array with attributes as keys.
     *
     * @param array $entry Attributes array as retrieved from ldap_get_attributes() or ldap_get_entries()
     * @param bool  $flat  Convert one-element-array values into strings (not implemented)
     *
     * @return array Hash array with attributes as keys
     */
    public static function normalize_entry($entry)
    public static function normalize_entry($entry, $flat = false)
    {
        if (!isset($entry['count'])) {
            return $entry;
tests/Framework/DBOracle.php
New file
@@ -0,0 +1,22 @@
<?php
/**
 * Test class to test rcube_db_oracle class
 *
 * @package Tests
 * @group database
 * @group oracle
 */
class Framework_DBOracle extends PHPUnit_Framework_TestCase
{
    /**
     * Class constructor
     */
    function test_class()
    {
        $object = new rcube_db_oracle('test');
        $this->assertInstanceOf('rcube_db_oracle', $object, "Class constructor");
    }
}
tests/Framework/ImapSearch.php
New file
@@ -0,0 +1,20 @@
<?php
/**
 * Test class to test rcube_imap_search class
 *
 * @package Tests
 */
class Framework_ImapSearch extends PHPUnit_Framework_TestCase
{
    /**
     * Class constructor
     */
    function test_class()
    {
        $object = new rcube_imap_search(array(), true);
        $this->assertInstanceOf('rcube_imap_search', $object, "Class constructor");
    }
}
tests/Framework/Ldap.php
New file
@@ -0,0 +1,23 @@
<?php
/**
 * Test class to test rcube_ldap class
 *
 * @package Tests
 */
class Framework_Ldap extends PHPUnit_Framework_TestCase
{
    /**
     * Class constructor
     */
    function test_class()
    {
        // skip this test as we don't want to connect to ldap here
        $this->markTestSkipped('We do not connect to LDAP');
        $object = new rcube_ldap(array());
        $this->assertInstanceOf('rcube_ldap', $object, "Class constructor");
    }
}
tests/Framework/ResultMultifolder.php
New file
@@ -0,0 +1,20 @@
<?php
/**
 * Test class to test rcube_result_multifolder class
 *
 * @package Tests
 */
class Framework_ResultMultifolder extends PHPUnit_Framework_TestCase
{
    /**
     * Class constructor
     */
    function test_class()
    {
        $object = new rcube_result_multifolder;
        $this->assertInstanceOf('rcube_result_multifolder', $object, "Class constructor");
    }
}
tests/Selenium/bootstrap.php
@@ -38,7 +38,7 @@
    die("Fatal error: ini_set/set_include_path does not work.");
}
$rcmail = rcmail::get_instance('test');
$rcmail = rcmail::get_instance(0, 'test');
define('TESTS_URL',     $rcmail->config->get('tests_url'));
define('TESTS_BROWSER', $rcmail->config->get('tests_browser', 'firefox'));
tests/bootstrap.php
@@ -32,7 +32,7 @@
require_once(INSTALL_PATH . 'program/include/iniset.php');
rcmail::get_instance('test')->config->set('devel_mode', false);
rcmail::get_instance(0, 'test')->config->set('devel_mode', false);
// Extend include path so some plugin test won't fail
$include_path = ini_get('include_path') . PATH_SEPARATOR . TESTS_DIR . '..';
tests/phpunit.xml
@@ -15,6 +15,7 @@
            <file>Framework/DB.php</file>
            <file>Framework/DBMssql.php</file>
            <file>Framework/DBMysql.php</file>
            <file>Framework/DBOracle.php</file>
            <file>Framework/DBPgsql.php</file>
            <file>Framework/DBSqlite.php</file>
            <file>Framework/DBSqlsrv.php</file>
@@ -24,13 +25,16 @@
            <file>Framework/Imap.php</file>
            <file>Framework/ImapCache.php</file>
            <file>Framework/ImapGeneric.php</file>
            <file>Framework/ImapSearch.php</file>
            <file>Framework/Image.php</file>
            <file>Framework/Ldap.php</file>
            <file>Framework/LdapGeneric.php</file>
            <file>Framework/MessageHeader.php</file>
            <file>Framework/MessagePart.php</file>
            <file>Framework/Mime.php</file>
            <file>Framework/Rcube.php</file>
            <file>Framework/ResultIndex.php</file>
            <file>Framework/ResultMultifolder.php</file>
            <file>Framework/ResultSet.php</file>
            <file>Framework/ResultThread.php</file>
            <file>Framework/Smtp.php</file>