entity_noninterger_cleaning.patch 903 B

1234567891011121314151617181920212223
  1. diff --git a/includes/entity.inc b/includes/entity.inc
  2. index 2fefd59..0b80d53 100644
  3. --- a/includes/entity.inc
  4. +++ b/includes/entity.inc
  5. @@ -159,6 +159,18 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
  6. */
  7. public function load($ids = array(), $conditions = array()) {
  8. $entities = array();
  9. +
  10. + # PATCH http://drupal.org/node/1003788#comment-5195682
  11. + // Clean the $ids array to remove non-integer values that can be passed
  12. + // in from various sources, including menu callbacks.
  13. + if (is_array($ids)) {
  14. + foreach ($ids as $key => $id) {
  15. + if (empty($id) || ((string) $id !== (string) (int) $id)) {
  16. + unset($ids[$key]);
  17. + }
  18. + }
  19. + }
  20. + # endpatch
  21. // Revisions are not statically cached, and require a different query to
  22. // other conditions, so separate the revision id into its own variable.