Hi folks, I have a Drupal 7 site that when I enable PathAuto, I get the following error routinely. Not on every page load but I'd say 35% of them generate this error.

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 173 of C:\Inetpub\vhosts\scottrushing.us\httpdocs\includes\entity.inc).

If I disable the module the errors go away. I've read several threads where others have had the issue but I haven't found much in the way of a clear fix to the problem. Suggestions?

Comments

Dave Reid’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

If it's happening on normal page load, then it's not Pathauto at fault. You'd need to do some backtrace debugging to figure out what is causing things leading up to the error in order for me to be able to provide any assistance.

lex0r’s picture

Title: array_flip() Error » array_flip() warning

Hi all,

I think I know at least one use case that leads to this warning: node save. The condition of seeing it is pretty simple. You have to define a path alias that uses one of the node terms as part of the resulting URL alias (category, section etc.). When you save a node that has path aliases configured as above, and do not specify the term, Drupal will attempt to find this term's name (if it's used in the path pattern) and will attempt to load this term by ID. It will finally have something like array('' => NULL) passed to array_flipp because the term wasn't selected, resulting in the warning and a not-so-nice URL that will miss at least one path component.

I think pathauto or token should handle this error, because it is natural to check the data your module uses. A patch is welcome :)

sdrushing’s picture

So I think I basically traced this back to the template/theme I was using on the site. Since I've changed out the theme, I haven't noticed this issue. Will continue to monitor though..

ben.kyriakou’s picture

Status: Postponed (maintainer needs more info) » Fixed

Since this issue appears to have been due to a theme rather than Pathauto, and it hasn't seen any recent activity, I'm going to mark this as Fixed. Feel free to move this back to Active if you have further questions.

Status: Fixed » Closed (fixed)

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