API page: http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/drupa...

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

There is no mention of what happens when the file is not found. A quick test returned a binary zero. There may be other possibilities in the code.

CommentFileSizeAuthor
#7 common.inc-documentation-1908192-7.patch548 bytesmitron
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Title: Returns FALSE if the file is not found. » document that drupal_get_filename() Returns FALSE if the file is not found.
Version: 7.x-dev » 8.x-dev
Issue tags: +Novice, +Needs backport to D7

Actually, there is no return value if the file isn't found -- it doesn't return FALSE or any other value. Anyway, this should be documented, in 8.x first and then backported to 7.x.

jhodgdon’s picture

Title: document that drupal_get_filename() Returns FALSE if the file is not found. » Document that drupal_get_filename() has no return value if the file is not found

whoops, title is still not accurate

mitron’s picture

A function without a return statement returns NULL. It would be great if there was a test that asserted the return value was NULL for a file that did not exist. Does such a test exist?

jhodgdon’s picture

This issue is about the documentation matching the code, which it currently doesn't.

mitron’s picture

Sure but before we write the documentation, we better make sure we actually understand the code.

peterx’s picture

mitron’s picture

How about this?

mitron’s picture

Status: Active » Needs review
mitron’s picture

jhodgdon’s picture

Assigned: Unassigned » jhodgdon
Status: Needs review » Reviewed & tested by the community

Thanks, I'll get this committed shortly.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
Status: Reviewed & tested by the community » Fixed

Thanks again! Committed to both 8.x and 7.x.

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