Breaking this off from #1191236: Correct file_copy, file_move, file_save_data, and drupal_realpath to match documentation and their unmanaged counterparts.

The documentation for the $uri parameter to drupal_realpath() says, in part:

If this value is omitted, Drupal's default files directory will be used [public://].

However, this claim is untrue. Omitting the $uri parameter will actually result in a PHP warning, and the function will return FALSE.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pillarsdotnet’s picture

This patch changes the docs to match the code.

pillarsdotnet’s picture

Status: Active » Needs review
mr.baileys’s picture

I think we should limit the change to just dropping the "If this value is omitted, Drupal's public files directory will be used [public://]." part. Technically, the value can't be omitted anyway, since it is a mandatory function argument. Granted, it can be an empty string, but then that's just an error on behalf of the calling code, and we don't babysit broken code...

pillarsdotnet’s picture

I think we should limit the change to just dropping the "If this value is omitted, Drupal's public files directory will be used [public://]." part.

As requested. (That's actually a larger change, btw.) For alternative solution, see #1192470: Make code of drupal_realpath() match docs.

pillarsdotnet’s picture

Title: Make the docs of drupal_realpath() match the code. » Make docs of drupal_realpath() match code.
Issue tags: +Needs backport to D7
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

This is the right way to do it. We don't want to start documenting what happens in every function if you don't supply the required arguments.

7.x/8.x please...

webchick’s picture

Status: Reviewed & tested by the community » Fixed

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

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