]> granicus.if.org Git - php/commitdiff
Improve comment on RFC 1867 filename handling
authorBishop Bettini <bishop@php.net>
Wed, 19 Feb 2020 16:30:32 +0000 (11:30 -0500)
committerBishop Bettini <bishop@php.net>
Wed, 19 Feb 2020 16:30:32 +0000 (11:30 -0500)
It was pointed out on the internals ML[1] that the basename comment
around RFC 1867 file handling was confusing. The comment seemed to
say that the basename handling was only necessary because of some
esoteric bug in Windows IE. In fact that comment applied to earlier
versions of the code and was, therefore, misleading. The comment
needs to clear that basename is required per RFC 7578[2].

[1]:https://externals.io/message/108624
[2]:https://tools.ietf.org/html/rfc7578

main/rfc1867.c

index ba734c9646184826e664e8e2bedc976ab44e5df1..4dfa6abcc74b6d778e91fdca353968334c53cd69 100644 (file)
@@ -1136,11 +1136,11 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
                                snprintf(lbuf, llen, "%s_name", param);
                        }
 
-                       /* The \ check should technically be needed for win32 systems only where
-                        * it is a valid path separator. However, IE in all it's wisdom always sends
-                        * the full path of the file on the user's filesystem, which means that unless
-                        * the user does basename() they get a bogus file name. Until IE's user base drops
-                        * to nill or problem is fixed this code must remain enabled for all systems. */
+                       /* Pursuant to RFC 7578, strip any path components in the
+                        * user-supplied file name:
+                        *  > If a "filename" parameter is supplied ... do not use
+                        *  > directory path information that may be present."
+                        */
                        s = _basename(internal_encoding, filename);
                        if (!s) {
                                s = filename;