Mibew Messenger Community

General => Support => Topic started by: stanhills11 on June 08, 2015, 01:24:02 PM

Title: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: stanhills11 on June 08, 2015, 01:24:02 PM
Sorry to bother you again.. but I'm facing another issue now. I've already installed the software but now I'm not able to go the login page. I tried to open the page:
http://<domain.com>/Mibew/index.php/operator/login?login=admin

but it shows this error:

Warning: array_keys() expects parameter 1 to be array, string given in /<path>/Mibew/libs/classes/Mibew/Cache/CacheFactory.php on line 105

Warning: array_diff(): Argument #1 is not an array in /<path>/Mibew/libs/classes/Mibew/Cache/CacheFactory.php on line 105

Fatal error: Unsupported operand types in /<path>/Mibew/libs/classes/Mibew/Cache/CacheFactory.php on line 115

The script from line 104 to 124 is this:

 // Make sure all passed options are known
        $unknown_options = array_diff(array_keys($options), array_keys($defaults));
        if (count($unknown_options) != 0) {
            throw new \InvalidArgumentException(sprintf(
                'These options are unknown: %s',
                implode(', ', $unknown_options)
            ));
        }

        if (empty($this->options)) {
            // The options are set for the first time.
            $this->options = $options + $defaults;
        } else {
            // Update only specified options.
            $this->options = $options + $this->options;
        }

        // Cached instance of cache is not valid any more. New one should be
        // created.
        $this->cache = null;
    }
Title: Re: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: Dmitriy Simushev on June 08, 2015, 01:50:06 PM
First of all it's not a private conversation, thus there should be separated topics for each problem. That is why I've moved the question to a new topic. Just keep in mind that we try to make the forum useful and searchable for all its users.

Next, it seems that something is wrong with "cache" section of the "config.yml" file. Could you provide it?
Title: Re: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: stanhills11 on June 08, 2015, 02:30:16 PM
Here is the cache section of the "config.yml":

# Cache subsystem
cache: "file_system"
    # This value determines where the cached data will be stored. Possible
    # values are "none", "file_system" and "memcached".
    #
    # If "none" is used the caching will be disabled. This option should be used
    # only if none of the other options works.
    #
    # If "file_system" is used the cached data will be stored in files within
    # the "cache/" directory. Notice, that the file system storage does not work
    # on NFS systems bucause exclusive file locks are not supported where.
    #
    # If "memcached" is used the cached data will be stored in Memcached
    # storage. Before using this kind of storage make sure PHP's memcached
    # extension is installed and enabled.
storage: file_system

    # The lines below represents default Memcached server configurations. They
    # will be used only if the "storage" option is set to "memcached".
memcached_servers:
        - host: localhost
          port: 11211
          # The "weight" field is optional and can be omitted.
          weight: 0
          # Actually, one can use any number of memcached servers he wants. Just
          # add servers description like the one above.

I tried to use cache: "none" but the same thing happened. Thank you very much for support.
Title: Re: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: Dmitriy Simushev on June 08, 2015, 02:40:30 PM
The whitespace at lines beginnings has matter. It's described in every description of YAML format. So the correct section is:

Code: [Select]
# Cache subsystem
cache: "file_system"
    # This value determines where the cached data will be stored. Possible
    # values are "none", "file_system" and "memcached".
    #
    # If "none" is used the caching will be disabled. This option should be used
    # only if none of the other options works.
    #
    # If "file_system" is used the cached data will be stored in files within
    # the "cache/" directory. Notice, that the file system storage does not work
    # on NFS systems bucause exclusive file locks are not supported where.
    #
    # If "memcached" is used the cached data will be stored in Memcached
    # storage. Before using this kind of storage make sure PHP's memcached
    # extension is installed and enabled.
    storage: file_system

    # The lines below represents default Memcached server configurations. They
    # will be used only if the "storage" option is set to "memcached".
    memcached_servers:
        - host: localhost
          port: 11211
          # The "weight" field is optional and can be omitted.
          weight: 0
          # Actually, one can use any number of memcached servers he wants. Just
          # add servers description like the one above.
Title: Re: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: stanhills11 on June 08, 2015, 02:55:51 PM
I did remove some spaces earlier, because it was not running the installation. Now, I copy and pasted the code exactly as you mentioned but it is showing the following message:

Fatal error: Uncaught exception 'Symfony\Component\Yaml\Exception\ParseException' with message 'Unable to parse at line 57 (near " storage: file_system").' in /<pat>/Mibew/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php:285 Stack trace: #0 /<path>/Mibew/libs/common/configurations.php(35): Symfony\Component\Yaml\Parser->parse('# IMPORTANT: Be...') #1 /<path>/Mibew/libs/init.php(32): load_system_configs() #2 /<path>/Mibew/index.php(21): require_once('/home3/ahsanft/...') #3 {main} thrown in /<path>/Mibew/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php on line 285
Title: Re: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: Dmitriy Simushev on June 08, 2015, 03:00:43 PM
I've just missed one more mistake in your configs section. The correct one is:

Code: [Select]
# Cache subsystem
cache:
    # This value determines where the cached data will be stored. Possible
    # values are "none", "file_system" and "memcached".
    #
    # If "none" is used the caching will be disabled. This option should be used
    # only if none of the other options works.
    #
    # If "file_system" is used the cached data will be stored in files within
    # the "cache/" directory. Notice, that the file system storage does not work
    # on NFS systems bucause exclusive file locks are not supported where.
    #
    # If "memcached" is used the cached data will be stored in Memcached
    # storage. Before using this kind of storage make sure PHP's memcached
    # extension is installed and enabled.
    storage: file_system

    # The lines below represents default Memcached server configurations. They
    # will be used only if the "storage" option is set to "memcached".
    memcached_servers:
        - host: localhost
          port: 11211
          # The "weight" field is optional and can be omitted.
          weight: 0
          # Actually, one can use any number of memcached servers he wants. Just
          # add servers description like the one above.

You would be better to read something about YAML format before asking more questions...
Title: Re: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php
Post by: stanhills11 on June 08, 2015, 03:50:47 PM
Thank you very much Dmitriy Simushev. I had a few other issues as well but I fixed those. Actually this was a new thing for me and I was basically in testing phase. Thank you very much for you help and support. :)