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.
I was trying to write code to check if a site was verified, but it turns out $node->verified is set to "0" as a string, not an integer.
The problem with that is...
if ($node->verified) {
print '$node->verified always returns true, even when it is 0, because it's a string.';
)
I patched hook_load for site, platform, server, and task modules to set the value to an integer if it is numeric.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2944853-hook-load-integer.patch | 1.76 KB | Jon Pugh |
Comments
Comment #3
Jon PughComment #4
Jon PughComment #6
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThanks, I've merged this with only a few extra spaces that phpcs was complianing about.
Comment #8
Jon PughNot sure what I was thinking, changed it to just cast to (int)!.
Branch deleted.