PHP 4.0 Bug #7597 Updated: similar to #5375. when filtering double slashes from file upload
| From: | shensche at defcom dot de | Date: | Wed, 29 Nov 2000 12:45:30 +0000 |
| Subject: | PHP 4.0 Bug #7597 Updated: similar to #5375. when filtering double slashes from file upload | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39564@lists.php.net to get a copy of this message | ||
ID: 7597
User Update by: shensche@defcom.de
Old-Status: Feedback
Status: Open
Bug Type: Filesystem function related
Description: similar to #5375. when filtering double slashes from file upload
of course, for example a simple echo (echo "before ereg: $src";):
before ereg: /tmp//phpTc5nNp
after ereg: /tmp/phpTc5nNp
Previous Comments:
---------------------------------------------------------------------------
[2000-11-14 06:10:36] stas@php.net
Can you please print $src before and after the ereg and let
us know what happened there?
---------------------------------------------------------------------------
[2000-11-02 13:49:10] shensche@defcom.de
when filtering the double slashes from "tmp_name" from an $HTTP_POST_FILE, it cannot be
moved to the proper location anymore. this is similar to the problem addressed by bugreport #5375
with windowsNT.
config: php version 4.03pl1 in safe-mode
with mysql and gd
on a suse linux 6.4
well, but i know it is not so much of a problem: just do not tamper with the "tmp_name"
and everything is alright. does anyone know a reason for really doing that?
cheers,
sebastian
------------ example code -------------------------
<?php
if ($HTTP_POST_VARS["update"] == 1) {
$src = $HTTP_POST_FILES["upload_file"]["tmp_name"];
/*
* BUG here: double slashes are stripped and php cannot * move the uploaded file anymore.
*/
$src = ereg_replace ("//", "/", $src);
move_uploaded_file ($src, "pic.jpg");
}
?>
<html>
<body>
<form action="<?php echo $PHP_SELF ?>" method="POST"
enctype="multipart/form-data">
<input type="hidden" name="update" value="1">
hochladen: <input type="file" name="upload_file"><br>
<img src="pic.jpg"><br>
<input type="submit">
</form>
</body>
</html>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7597