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.
Hello,
I use a print html link on a custom page wich is not a node. I get often (not always) the error.
Notice : Undefined property: stdClass::$content dans _print_generate_path() (ligne 678 ... in print.pages.inc
But the module seems to work fine anyways.
Seems that the node object don't have the property content ligne 678
$node->content = preg_replace('!\s*<div class="contextual-links-wrapper">.*?</div>!sim', '', $node->content);
I added a condition in order to stop the error message
if (isset($node->content)){
$node->content = preg_replace('!\s*<div class="contextual-links-wrapper">.*?</div>!sim', '', $node->content);
}
Any other idea ?
Thanks
Comment | File | Size | Author |
---|---|---|---|
#3 | notice-undefined-property-stdclass-content-2124477-3.patch | 662 bytes | Elin Yordanov |
Comments
Comment #1
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedLooking at the code I think this is a quite strange line. On line 651 the node object is created and as I can see... the content variable is never added to the node object. So I wonder why this line is there at all...
Comment #2
donpwinston CreditAttribution: donpwinston commentedI get the same error. Why is the "content" property being used? It does not even appear to have been added to the object yet. (I'm using v1.3)
Do not know why 2.0 is "recommended". It does not work.
Comment #3
Elin Yordanov CreditAttribution: Elin Yordanov commentedI think it was intended to clear
$node->body
from contextual links, but mistakenly used$node->content
. Following patch fixes this issue. Please review.Comment #4
pietrocap CreditAttribution: pietrocap commentedHi,
patch in #3 works for me.
Comment #5
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedWorks for me as well!
Comment #6
hwasem CreditAttribution: hwasem commentedPatch #3 also worked for me. Thank you very much!
Heidi
Comment #7
laevensv@gmail.com CreditAttribution: laevensv@gmail.com commentedHi
Thanks !
Comment #8
laevensv@gmail.com CreditAttribution: laevensv@gmail.com commentedHi
Thanks !
Comment #9
hawkbreeze CreditAttribution: hawkbreeze commentedPatch #3 work for me too.
Comment #10
fenstratConfirming #3 is RTBC.
Comment #11
DanChadwick CreditAttribution: DanChadwick commentedAgain/also confirming RTBC. Thanks.
This bug is unfortunate for me because the URL that is affected is being attacked by spambots, so I get a ton of PHP notices in the error log.
Comment #12
webadpro CreditAttribution: webadpro commentedThis is RTBC
Comment #13
upunkt CreditAttribution: upunkt commentedYes, absolutely time to commit it. #3 still works.
Comment #14
nattsPlease commit #3!
Comment #15
cpierce42It's been a year I am also voting for this patch. Subscribing.
Comment #17
jcnventura CreditAttribution: jcnventura commentedThis is what happens when you apply the 7.x-2.x patch to the 7.x-1.x branch.. I've committed this fix, but 7.x-1.x will not receive any other improvements (like support for the newer PDF libs).