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.
Was browsing the code and noticed that entity_ui_controller creates two static variables with drupal_static(__FUNCTION__) so it's just going to be the same variable with two names.
Comment | File | Size | Author |
---|---|---|---|
#3 | entity-duplicate-static-1359492-3.patch | 1.48 KB | loganfsmyth |
#1 | entity-duplicate-static-1359492-1.patch | 1.13 KB | loganfsmyth |
Comments
Comment #1
loganfsmyth CreditAttribution: loganfsmyth commentedQuick and easy fix.
Comment #2
fagoWell, the serve a slightly different purpose. $all is only set if the info is loaded completely. With your patch the function might return incomplete results if all controllers are requested.
This weird logic is used to avoid loading all ui-controllers even if only one is requested.
Clean-up and/or docs to clarify that are of course highly welcome.
Comment #3
loganfsmyth CreditAttribution: loganfsmyth commented@fago I see what you are saying, and after reviewing the function further, I think it simply doesn't work as intended. Currently it has the very problem you mention. http://drupalcode.org/project/entity.git/blob/refs/heads/7.x-1.x:/entity...
Currently the function has this in it:
So $static and $all will both be references to the same value. Also, $all is only ever set, but never read.
I propose a new implementation that uses one static and addresses the initialization problem you mentioned.
Comment #4
loganfsmyth CreditAttribution: loganfsmyth commentedComment #5
fagothanks, committed.