On 2005/01/22, at 1:12, Ilia Alshanetsky wrote:
Moriyoshi Koizumi wrote:What is really confusing around this stuff, is that php_basename() is
all but designed to work on the filesystem where the script is running,
while the filename coming from the outside isn't necessarily given in
the same scheme. For example, php_basename() is unlikely to handle a
filename encoded in a different encoding than the system's. In fact,
'\\' (0x5c) appears in the second byte of a Shift_JIS sequence, which
is the most commonly used multibyte encoding in Japan.
Well, there are several problems with this. On a *NIX system it is perfectly valid to have a file name with \ characters in it. They cause no problems for the system or the upload code. However, if things like s = strrchr(filename, '\\'); are done the filename is trimmed. In addition that older variant of the code would still have problem with multibyte languages unless mbstring extension was compiled & enabled.
Right, but the browsers send filenames in its particular form, whose
path delimiter could be '\\'. Isn't this causing another problem on
a *NIX system where '\\' isn't regarded as a delimiter by php_basename()?
BTW,
- if (PG(magic_quotes_gpc)) { - s = s ? s : filename; - tmp = strrchr(s, '\''); - s = tmp > s ? tmp : s; - tmp = strrchr(s, '"'); - s = tmp > s ? tmp : s; - }
I think this portion is just the unwanted one. The rest should be kept either way.
Moriyoshi
Ilia
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php