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.

Comments

jweowu’s picture

Status: Active » Needs review
StatusFileSize
new472 bytes
davisben’s picture

Status: Needs review » Fixed

Thanks for the patch! Committed to dev.

jweowu’s picture

Status: Fixed » Needs review
StatusFileSize
new469 bytes

There'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.

davisben’s picture

Status: Needs review » Fixed

Nice and simple. Committed to dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.