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.
It's critical that you use the triple-equals strpos() === 0
when checking strpos()
for something at the beginning of the string, as otherwise PHP will happily coerce FALSE
to zero, and you'll get bugs like this one, which was causing things like node_load('advanced_help');
to happen.
Comment | File | Size | Author |
---|---|---|---|
#3 | weight-numeric-nid-1998626-3.patch | 469 bytes | jweowu |
#1 | weight-strpos_equals_zero-1998626-1.patch | 472 bytes | jweowu |
Comments
Comment #1
jweowu CreditAttribution: jweowu commentedComment #2
davisbenThanks for the patch! Committed to dev.
Comment #3
jweowu CreditAttribution: jweowu commentedThere's another bug in the same function, with a similar end result (e.g.
node_load('add/name-of-node-type');
, so I'm just going to add the new patch in this issue as well.Comment #4
davisbenNice and simple. Committed to dev.