Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Recently installed file_entity 7.x-2.0-alpha3 to use with Media 7.x-2.0-alpha3. I haven't had a chance to test its functionality but I get this recurrent warning:
Warning: array_keys() expects parameter 1 to be array, null given in file_entity_admin_menu_map() (line 2478 of /home/mysite/public_html/testnwp/sites/all/modules/file_entity/file_entity.module).
Comments
Comment #1
Proteo CreditAttribution: Proteo commentedSame over here...
Edit: I just noticed that the error is caused because there are no file types created; I mean, the module gets installed, but no file types are created during the install process. The error is thrown by the function in charge to create links for the administration menu.
Comment #2
Abhinesh Sharma CreditAttribution: Abhinesh Sharma commentedHi All,
It's File Entity version problem. If we are using File Entity 7.x-2.0-alpha2 with Media Module version 7.x-2.0-alpha2 . After install both module it's throw same error.
The Main Region is file Entity module some Time don't create file_metadata filed in Database. After you want to update the file entity version but you can't because file entity module don't provide uninstall option in back-end.
So If you have found any error like PDO table{file_managed} or Table {file_metadata} then Check Database table Structure.
Search 2 Tables in Database are exist or not
1) file_managed
2)file_metadata
and Please verify In file_managed table field "type" is exist or not. if not then create Field
type varchar(50) utf8_general_ci No undefined
And for file_metadata Please Run Below Query in Sql:-
--
-- Table structure for table `file_metadata`
--
CREATE TABLE IF NOT EXISTS `file_metadata` (
`fid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The file_managed.fid of the metadata.',
`name` varchar(255) NOT NULL COMMENT 'The name of the metadata (e.g. ’width’).',
`value` longblob COMMENT 'The value of the metadata (e.g. ’200px’).',
PRIMARY KEY (`fid`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Cache images dimensions.';
May this Post will help for use File Entity and Media Module for any version.
Thanks
Abhinesh Sharma
Comment #3
DeactivatedGhostAccountLetPeopleDeletePosts CreditAttribution: DeactivatedGhostAccountLetPeopleDeletePosts commented.
Comment #4
Franz Phillips CreditAttribution: Franz Phillips commentedsaved me too! thanks so much!!!
Comment #5
lu_smithcon CreditAttribution: lu_smithcon commentedI have installed File Entity v7.x-2.0-alpha3 (I had previously uninstalled and deleted media and its file entity) and am receiving the above warning too (Warning: array_keys() expects parameter 1 to be array, null given in file_entity_admin_menu_map() (line 2478 of /path/to/drupal/sites/all/modules/file_entity/file_entity.module)). I completed the above steps so my db has both file_managed (with a field 'type') and file_metadata; and I am till getting the warning.
Comment #6
Dantalion CreditAttribution: Dantalion commented@lardfw
I've had also this issue. I've followed the steps described by Abhinesh Sharma, but it didn't work. Still the same warning. So what I've done was:
1. Updated the database (siteroot/update.php).
2. After the update a message about an error came out stating file_metadata exists (as I run MySQL query as in comment #2).
3. I dropped the table from the database and run the update again.
4. It works - no more warnings.
Additionally I have to mention that I use Polish besides English language in this project. I hope I described all the steps crucial to the process because I was a little lost and angry. :)
Comment #7
usaginyunyu CreditAttribution: usaginyunyu commentedHi!
I get the same error when installing instagram block.
I have installed media 7.x-1.4 (but not activated) and file entity 7.x-2.0-alpha3
The worst thing is that after this error appears my blog gives me an error and disappears...
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pruebasky.file_metadata' doesn't exist: SELECT * FROM {file_metadata} WHERE fid IN (:fids_0); Array ( [:fids_0] => 42 ) in file_entity_file_load()
??
Any suggestions?
Ups, by the way, I´ve just desactivated file entity since I´m not using it (maybe is required the ubercart? but all seem working fine ) and got my blog page back
Comment #8
mausolos CreditAttribution: mausolos commentedConfirming the issue. I will attempt to apply #2 shortly.
I have a new multisite I'm building/migrating from D6. I disabled and uninstalled Media 1.x, then rm -r'd it. Then, I downloaded and installed Media 2.0 alpha3.
When I go to ~/admin/config, I get this:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'insidedev_library.file_metadata' doesn't exist: SELECT * FROM {file_metadata} WHERE fid IN (:fids_0); Array ( [:fids_0] => 91 ) in file_entity_file_load() (line 206 of ~/sites/all/modules/contrib/file_entity/file_entity.file.inc).
Looks like someone forgot something rather important in the install script! (#2?)Thanks!
EDIT:
I first applied the suggestion in #2. That allowed the page to load. Drupal informed me that I should check the Status page, which indicated I should run drush updatedb. I did this for each of the sites, and indeed, this seems to have fixed everything.
The takeaway, then, is to always run drush updatedb when doing a manual uninstall/install to go up to a new module version! :)
Comment #9
peterro CreditAttribution: peterro commentedSame warning re array_keys() expects param...
Simply:
>drush updatedb
helps.
Comment #10
Dave ReidLooks to be resolved based on the latest comments.
Comment #12
soezkan CreditAttribution: soezkan commentedThanks @Abhinesh Sharma.
Worked for me.