API page: http://api.drupal.org/api/drupal/includes%21path.inc/function/drupal_val...

Enter a descriptive title (above) relating to function drupal_valid_path, then describe the problem you have found:

This function returns a false TRUE for fully spec'd urls that don't exist. Try this on the 'Execute PHP' page, substituting localhost or whatever, and see what happens.

$test = drupal_valid_path( 'http://d7b.dev/when/pigs/fly');
echo $test ? 'True' : 'False';

Comments

jhodgdon’s picture

Status: Active » Closed (works as designed)

See: http://drupal.org/glossary#path -- you are passing in a full URL and not a path.

If you pass in a full URL, then it will pass the is_external() test in this function and return TRUE always. So... I think this is a "works as designed" issue. If you pass in only the path ('when/pigs/fly') it should work as you expect.