Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
.
Comment | File | Size | Author |
---|---|---|---|
#4 | drupal_realpath-make_docs_match_code-1192466-4.patch | 911 bytes | pillarsdotnet |
#1 | drupal_realpath-make_docs_match_code-1192466-1.patch | 892 bytes | pillarsdotnet |
Comments
Comment #1
pillarsdotnet CreditAttribution: pillarsdotnet commentedThis patch changes the docs to match the code.
Comment #2
pillarsdotnet CreditAttribution: pillarsdotnet commentedComment #3
mr.baileysI 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...
Comment #4
pillarsdotnet CreditAttribution: pillarsdotnet commentedAs requested. (That's actually a larger change, btw.) For alternative solution, see #1192470: Make code of drupal_realpath() match docs.
Comment #5
pillarsdotnet CreditAttribution: pillarsdotnet commentedComment #6
jhodgdonThis 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...
Comment #7
webchickCommitted to 8.x and 7.x. Thanks!