Problem with drupal_valid_path In my custom module I'm using drupal_valid_path to check if a given alias exists before I create such.

$target_alias = 'some/path';
if(drupal_valid_path($target_alias, FALSE) === FALSE){
  // create 'some/path'
}


The function always returns FALSE and thus creates tons of identical aliases. What could be wrong?

I have tried various boolean expressions, such as: !drupal_valid_path or weak type test ==. To no avail.
I would guess the problem is that drupal_valid_path() is expecting a system path, and you're passing it an alias.

Fortunately there's a function to determine the system path from the alias, drupal_lookup_path(). I would have thought a simple change to your code like this would make it work:

$target_path = drupal_lookup_path('some/path');
if(drupal_valid_path($target_path, FALSE) === FALSE){
  // create 'some/path'
}