Author Topic: Fatal error: Unsupported operand types in /Mibew/libs/classes/Mibew/Cache/CacheFactory.php  (Read 8430 times)

0 Members and 1 Guest are viewing this topic.

stanhills11

  • Full Member
  • ***
  • Posts: 7
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;
    }

Dmitriy Simushev

  • Moderator
  • Native
  • *****
  • Posts: 345
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?
« Last Edit: June 08, 2015, 01:52:20 PM by Dmitriy Simushev »

stanhills11

  • Full Member
  • ***
  • Posts: 7
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.

Dmitriy Simushev

  • Moderator
  • Native
  • *****
  • Posts: 345
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.

stanhills11

  • Full Member
  • ***
  • Posts: 7
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

Dmitriy Simushev

  • Moderator
  • Native
  • *****
  • Posts: 345
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...

stanhills11

  • Full Member
  • ***
  • Posts: 7
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. :)