CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • warning: array_key_exists() [function.array-key-exists] - [Solved]
Pages: [1] 2

Author Topic: warning: array_key_exists() [function.array-key-exists] - [Solved]  (Read 5148 times)

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
warning: array_key_exists() [function.array-key-exists] - [Solved]
September 14, 2010, 05:55:50 pm
When doing a fresh install of 3.2, I hit the following error:

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/xxxx/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.

The lines of code that seem to contain the problem are:

/**
     * Function to retrieve the settings values from db
     *
     * @return array $defaults 
     * @static
     */
    static function retrieve(&$defaults)
    {
        require_once "CRM/Core/DAO/Domain.php";
        $domain = new CRM_Core_DAO_Domain();
        $domain->selectAdd( );

        if ( CRM_Utils_Array::value( 'q', $_GET ) == 'civicrm/upgrade' ) {
            $domain->selectAdd( 'config_backend' );
        } else {
            $domain->selectAdd( 'config_backend, locales, locale_custom_strings' );
        }
       
        $domain->id = CRM_Core_Config::domainID( );
        $domain->find(true);
        if ($domain->config_backend) {
            $defaults = unserialize($domain->config_backend);

            $skipVars = array( 'dsn', 'templateCompileDir',
                               'userFrameworkDSN',
                               'userFrameworkBaseURL', 'userFrameworkClass', 'userHookClass',
                               'userPermissionClass', 'userFrameworkURLVar',
                               'qfKey', 'gettextResourceDir', 'cleanURL',
                               'locale_custom_strings', 'localeCustomStrings' );
            foreach ( $skipVars as $skip ) {
                if ( array_key_exists( $skip, $defaults ) ) {
                    unset( $defaults[$skip] );
                }
            }

Can anyone suggest what changes might be needed to resolve the error?

Thanks for any help.
« Last Edit: September 16, 2010, 04:40:51 pm by Dave Smith »
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 02:19:00 am
Is it halting / effecting the installation process?  If not, and given that this is just a warning (having had a quick look at the code) i would say that it is nothing to worry about.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 02:45:45 am
Unfortunately it's producing this (against a very pretty pink background) when I login. Without resolving this issue it seems as if I can get no further :-(

warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/BAO/Setting.php on line 182.
« Last Edit: September 15, 2010, 03:25:45 am by Dave Smith »
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 04:08:52 am
What is your PHP version?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 05:41:09 am
PHP version -- 5.2.14
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 12:32:29 pm
To add some further information. When I login using my username and password I get the same repeating lines as indicated previously.

When I hit 'civicrm' I get this error message:

Fatal error: Uncaught exception 'Exception' with message 'Please make sure the folder is writable' in /home/uniondat/public_html/sites/all/modules/civicrm/packages/IDS/Monitor.php:218 Stack trace: #0 /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/IDS.php(134): IDS_Monitor->__construct(Array, Object(IDS_Init)) #1 /home/uniondat/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(88): CRM_Core_IDS->check(Array) #2 /home/uniondat/public_html/sites/all/modules/civicrm/drupal/civicrm.module(351): CRM_Core_Invoke::invoke(Array) #3 /home/uniondat/public_html/includes/menu.inc(348): civicrm_invoke() #4 /home/uniondat/public_html/index.php(18): menu_execute_active_handler() #5 {main} thrown in /home/uniondat/public_html/sites/all/modules/civicrm/packages/IDS/Monitor.php on line 218
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 12:36:10 pm
That's interesting. It says  'Please make sure the folder is writable'

Can you verify if CiviCRM has write access to sites/default ? and also to sites/default/files/civicrm ?

Just post here what the permissions are for those if you aren't sure what I am asking.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 05:14:52 pm
Dave - Might be a problem with the IDS package .ini file. Do make sure sites/default/files and all folders below are write-able by your web server user. If the following file exists, delete it (it will be recreated):

sites/default/files/civicrm/templates_c/en_US/ConifAndLog/Config.IDS.ini

(or if it's easier you can delete the entire templates_c directory and it's children)
Protect your investment in CiviCRM by  becoming a Member!

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 05:29:14 pm
Hershel - thanks for your continued advice.

The answer to your question is:

In sites/default the permissions are:

Read: available to user, group world
Write: available to no one
Execute: available to user, group, world

In sites/default/files the permissions are:

Read: available to user, group world
Write: available to user, group world
Execute: available to user, group, world

I do not have a  sites/default/files/civicrm. The only thing in the sites/default/files directory is .htaccess

I notice that in  sites/default/setting.php there is no write permission.
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 05:35:42 pm
Dave - I put up a response to Hershel which I think covers the points you are making.
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 05:58:05 pm
AFAIK CiviCRM will / needs to create a 'civicrm' directory under sites/default/files OR sites/yourMultiSiteSitename/files. If that 'civicrm' directory and the expected 'templates_c' sub-dir etc. (which is for smarty template cache) is not present - than my best guess is that the permiissions on 'files' are not allowing it to be created.

If you can't verify that permissions are the problem and you can't access any CiviCRM settings pages in your browser due to the errors - I guess I'd try one of 3 other things:
- make sure the CiviCRM schema has been properly loaded in your CiviCRM DB (should have 120-ish tables with civicrm_* names)
- issue the following SQL command in your CiviCRM DB to force CiviCRM to rebuild path / directory settings which are stored in the DB: UPDATE civicrm_domain set config_backend = NULL;
- since this is a new install, ditch it and try again - making sure you check for any errors during install (in the install UI and / or in your webserver logs)
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: warning: array_key_exists() [function.array-key-exists]
September 15, 2010, 09:39:38 pm
Hi Dave S

I just read your reply to Dave G saying that your response to Hershel covered his comments but I don't see any reference to  you following this:

Quote
sites/default/files/civicrm/templates_c/en_US/ConifAndLog/Config.IDS.ini

(or if it's easier you can delete the entire templates_c directory and it's children)

The error you are having is definitely one that would occur if the incorrect information were in the Config.IDS.ini file. This file kind of caches some settings & it is almost always the culprit when a server move is involved
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 16, 2010, 03:17:21 am
Some progress thanks to your suggestions.

The repeating 'warning: array_key_exists() ...' has now gone. I made sure that all the files under sites/default were writable and issued the SQL command suggested by Dave G. Which of these resolved that problem I am not sure. I have also checked and the database has been installed. Although it was a fresh install, an existing database was imported.

However, neither of these has generated the creation of a directory 'civicrm' under 'sites/default'.

Because I don't have a 'civicrm' directory, i don't have the 'Config.IDS.in' that both Dave G and Eileen are referring to, no template directory has been generated.

I do, however, still have the 'Fatal error: Uncaught exception 'Exception' with message ...' message that I referred to earlier.

I have checked the permissions for each of the lines and although they are all writable, none of them are executable. I am wondering whether this is part of the problem.

Thanks for your continued advice.
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: warning: array_key_exists() [function.array-key-exists]
September 16, 2010, 09:24:30 am
Quote from: Dave Smith on September 16, 2010, 03:17:21 am
Although it was a fresh install, an existing database was imported.

I would re-do the fresh install and make sure it's working properly before importing an existing database. If it's not a directory permissions issue than there's some setting in the existing DB ... OR in your civicrm.settings.php file which should also be found in sites/default ... which as pointing to the wrong location on your server.

In civicrm.setttings.php you should double-check values for civicrm_root and CIVICRM_TEMPLATE_COMPILEDIR
Protect your investment in CiviCRM by  becoming a Member!

Dave Smith

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
Re: warning: array_key_exists() [function.array-key-exists]
September 16, 2010, 03:20:45 pm
Thank you for your continuing efforts on this.

One last go at this before I try and organise a fresh install.

I have looked in civicrm.setttings.php as you suggested.

Interestingly I found the following:

$civicrm_root = '/home/uniondat/public_html/sites/all/modules/civicrm';
define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/home/xxxx/public_html/files/civicrm/templates_c/' );


When I checked this out, the directories and files that were missing from the sites/default directory are located in '/public_html/files/civicrm/templates_c/'. And this also includes the Config.IDS.ini file that Eileen was referring to.

Why that should be I don't know ... but I didn't do the installation. I don't know if this was an option that could be exercised during the set-up process.

So I am thinking that you may have cracked the problem. My only question now is how to do the necessary changes without messing up the whole programme.

Do I simply edit the civcicrm.settings.php file and point them towards sites/default which is where you are saying they should be located?
« Last Edit: September 16, 2010, 03:27:55 pm by Dave Smith »
"The philosophers have only interpreted the world, in various ways; the point is to change it." ... Marx

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • warning: array_key_exists() [function.array-key-exists] - [Solved]

This forum was archived on 2017-11-26.