I updated from redirect-7.x-1.0-beta2 to 3, which introduced a url redirect fieldset for all entities that support redirects. I now get this warning on editing media (from media module):

Warning: array_diff_key() [function.array-diff-key]: Argument #1 is not an array in redirect_field_attach_form() (line 1397 of /sites/all/modules/redirect/redirect.module).

Is this for Redirect or for Media to fix?

CommentFileSizeAuthor
#5 mediabeta4-arraydiff-warning_1190968.patch469 bytestheapi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Title: array_diff_key() warnings introduced in redirect-7.x-1.0-beta3 » array_diff_key() warnings in redirect caused by invalid entity_uri() result
Project: Redirect » D7 Media
Version: 7.x-1.0-beta3 » 7.x-1.x-dev

Sounds more like something in Media since a call to $uri = entity_uri($entity_type, $entity) should return either FALSE or array('uri' => '...', 'options' => array(...)) with the options array already defined. Redirect already handles the case if the return is FALSE.

Dave Reid’s picture

Project: D7 Media » Redirect

Well this seems to be that you cannot call entity_uri() on a file entity as it already has $entity->uri defined as a string. Core bug is #1057242: entity_uri() should not use $entity->uri (was $file->uri doesn't match the contract for uri callbacks). I need to add a workaround in Redirect, so moving back to my issue queue.

Dave Reid’s picture

Status: Active » Fixed

Fixed in Git with http://drupalcode.org/project/redirect.git/commit/ecf23c5. Thank you very much for reporting this issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

theapi’s picture

For those of us not ready to take the leap to Media 1.0-beta5 just yet, here's a modified version of the above patch that works with Media 1.0-beta4