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.
There is a d6 style node_load in the trigger module. See patch.
There is another in a comment in form.inc, I don't know whether that comment as a whole needs changing, or to just change that load to an EFQ.
$ grep -rHn "node_load(array" . --exclude-dir=sites
./includes/form.inc:4126: * $node = node_load(array('uid' => $uid, 'type' => $type));
Comment | File | Size | Author |
---|---|---|---|
#9 | 1366716_1.patch | 2.12 KB | googletorp |
trigger_node_load.patch | 529 bytes | naught101 | |
Comments
Comment #1
naught101 CreditAttribution: naught101 commentedwhoops
Comment #2
xjmCouple thoughts:
Comment #3
naught101 CreditAttribution: naught101 commentedheh, don't ask me, I've never used the code, I didn't even try to find out what it's for. I just noticed it in passing :)
Comment #4
xjm#764558: Remove Trigger module from core has been committed, so moving back to D7. :)
Comment #5
droplet CreditAttribution: droplet commentedtrigger_node_load.patch queued for re-testing.
Comment #6
catchLooks like this runs if you assign a user action to a node context, or something.
Also that arg() stuff is pre-Drupal 6 code, this should just be menu_get_object().
While this is going to break horribly if you set it up like that, clearly no-one is actually running into this, and the workaround is "don't set up a trigger like that" , so I don't think we can call it major.
Comment #7
xjmComment #8
googletorp CreditAttribution: googletorp commentedI'll give this a stab.
Comment #9
googletorp CreditAttribution: googletorp commented1. I added a test for testing _trigger_normalize_user_context(). I'm a bit unsure if I went about it the right way. Since the function looks that the active path and that always will be the patch job running the test - I overwrote
$_GET['q']
- but I'm not sure if that is the correct way of doing it.2. I cleaned up the code a but using menu_get_object() as suggested by catch.
3. I have taken a look at when _trigger_normalize_user_context is called - which only seems to be when the user logs in out etc. I have a hard time seeing when this could be an issue - since you need to be viewing a node - but I haven't really used the trigger module myself so I don't really now what the underlying functions are supposed to do.
Comment #10
YesCT CreditAttribution: YesCT commentedsince tests were added, removing needs tests tag.
Also, is a tests only patch appropriate here, to get the testbot to show the tests will fail without the fix? I think so, so needs work for that.