Follow-up to #1796596: Fix and prevent circular redirects

Problem/Motivation

Update hook 7100 does not do a registry rebuild or entity info cache clear, this only happens at the end of an update run. This was supposed to be happening because RedirectController is in a new location, so we cannot use the redirect entity controller in future update hooks without breaking some people's upgrades.

Proposed resolution

Do a manual registry rebuild & entity info cache clear

Remaining tasks

Patch

User interface changes

N/A

API changes

N/A

Comments

dave reid’s picture

olli’s picture

geerlingguy’s picture

Marked #2514978: entity.module 724 as a duplicate. After updating to 7.x-1.0-rc2, I got the following message during database updates:

$ drush updb -y
 Redirect  7100  Empty update hook.                                  
 Redirect  7101  Add status field.                                   
 Redirect  7102  Disable redirects that could cause infinite loops.
Do you wish to run all pending updates? (y/n): y
Performed update: redirect_update_7100                                                                              [ok]
Performed update: redirect_update_7101                                                                              [ok]
No circular redirects were found that could cause infinite loops.                                                   [ok]
Performed update: redirect_update_7102                                                                              [ok]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:1474         [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:1474                                   [warning]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:724          [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:724                                    [warning]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:84           [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:84                                     [warning]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:724          [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:724                                    [warning]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:724          [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:724                                    [warning]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:724          [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:724                                    [warning]
class_implements(): Class RedirectController does not exist and could not be loaded entity.module:84           [warning]
in_array() expects parameter 2 to be array, boolean given entity.module:84                                     [warning]
'all' cache was cleared.                                                                                       [success]
Finished performing updates. 
dave reid’s picture

Status: Active » Needs review
StatusFileSize
new834 bytes

Ok let's try this. Can anyone reproduce this to ensure this resolves the issue?

dave reid’s picture

Status: Needs review » Reviewed & tested by the community

I managed to reproduce the original issue with those updating from rc1 and confirmed this will resolve the errors.

dave reid’s picture

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Committed #4 to 7.x-1.x.

  • Dave Reid committed a51ee86 on 7.x-1.x
    Issue #2485459 by Dave Reid: Update hook 7100 does not do a registry...

Status: Fixed » Closed (fixed)

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

sebumd’s picture

Since I had already installed the module and ran into this issue after upgrading from rc1->rc3, I manually did the following lines in my template.php. One important note is that this issue did not happen in a dev environment after installing via the Drupal web interface (with roughly the same database as prod). This happened when I did a git pull and overwrote rc1 with rc3 and then did an update.php.

registry_rebuild();
entity_info_cache_clear();

I've also cleared the cache, used the registry_rebuild module, and uninstalled/reinstalled the module. I still receive the following error:

Warning: class_implements(): Class RedirectController does not exist and could not be loaded in entity_crud_get_info() (line 724 of /var/www/html/daiss/sites/all/modules/contrib/entity/entity.module).
Warning: in_array() expects parameter 2 to be array, boolean given in entity_crud_get_info() (line 724 of /var/www/html/daiss/sites/all/modules/contrib/entity/entity.module).
Warning: class_implements(): Class RedirectController does not exist and could not be loaded in entity_type_supports() (line 84 of /var/www/html/daiss/sites/all/modules/contrib/entity/entity.module).
Warning: in_array() expects parameter 2 to be array, boolean given in entity_type_supports() (line 84 of /var/www/html/daiss/sites/all/modules/contrib/entity/entity.module).

pbattino’s picture

Same thing here. It does not look fixed at all.
I get this even prior to enable the module, as soon as I clear caches. If I remove the module from the /modules/ directory, the problem disappears.

pbattino’s picture

Actually not! I found out that this happened when I switched branch, so it's an inconsistency created by mismatch between code and db. Clearing caches resolves the problem.

dani3lr0se’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc3

Just thought I'd drop message here to say that I ran into this today, on version 7.x-1.0-rc3. I was running `drush upwd admin --password="newpassword"` to reset passwords in our Drupal 7 multisite instance. We have the most recent version of the Redirect module and Drupal core (if that matters). Here is the output after running the command:

```
class_implements(): Class RedirectController does not exist and could not be loaded [warning]
entity.module:1474
in_array() expects parameter 2 to be array, boolean given entity.module:1474 [warning]
class_implements(): Class RedirectController does not exist and could not be loaded [warning]
entity.module:724
in_array() expects parameter 2 to be array, boolean given entity.module:724 [warning]
class_implements(): Class RedirectController does not exist and could not be loaded [warning]
entity.module:724
in_array() expects parameter 2 to be array, boolean given entity.module:724 [warning]
class_implements(): Class RedirectController does not exist and could not be loaded [warning]
entity.module:724
in_array() expects parameter 2 to be array, boolean given entity.module:724 [warning]
class_implements(): Class RedirectController does not exist and could not be loaded [warning]
entity.module:84
in_array() expects parameter 2 to be array, boolean given entity.module:84 [warning]
```

I didn't try any of the above fixes yet because we're on the most recent version of everything, so there is nothing to upgrade to. Even though I get this message, the command still runs and completes as intended.

Hope this was ok to share here, even though the issue is closed.