I give the warning when implement hook_redirect_load() from api.

<?php
  function mymodule_redirect_load(array &$redirects, $types) {
  }

Warning: Parameter 1 to mymodule_redirect_load() expected to be a reference, value given in DrupalDefaultEntityController->attachLoad() (line 368 of includes\entity.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

belyj_vladislav created an issue. See original summary.

belyj_vladislav’s picture

Issue summary: View changes
belyj_vladislav’s picture

Use the hook_redirect_load_alter() instead hook_redirect_load()

belyj_vladislav’s picture

Status: Active » Needs review
Dave Reid’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

I think the docs should not have the reference around &$redirects, because it's an array of objects, and objects are passed by reference (technically by pointer). So there's no need to modify the array by reference.

belyj_vladislav’s picture

belyj_vladislav’s picture

Status: Needs work » Needs review
belyj_vladislav’s picture

Assigned: belyj_vladislav » Unassigned
Chris Matthews’s picture

Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Issue tags: -warning, -entity, -line 368

The patch in #6 is 2 years old, but still applies cleanly to the latest 7.x-1.x-dev and fixes this issue for me so changing the issue status accordingly.

Checking patch redirect.api.php...
Checking patch redirect.module...
Hunk #1 succeeded at 532 (offset 11 lines).
Applied patch redirect.api.php cleanly.
Applied patch redirect.module cleanly.
Chris Matthews’s picture

Status: Needs review » Reviewed & tested by the community
alex_optim’s picture

Looks good.

voleger’s picture

Looks good

pifagor’s picture

  • pifagor committed 959fa10 on 7.x-1.x
    Issue #2763681 by belyj_vladislav, Chris2, voleger, Dave Reid, pifagor,...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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