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.
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
Comment #1
Dave ReidIf 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.
Comment #2
lex0r CreditAttribution: lex0r commentedHi 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 :)
Comment #3
sdrushing CreditAttribution: sdrushing commentedSo 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..
Comment #4
ben.kyriakou CreditAttribution: ben.kyriakou as a volunteer commentedSince 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.