ID:               40537
 Updated by:       [EMAIL PROTECTED]
 Reported By:      stloukal at programator dot cz
-Status:           Open
+Status:           Feedback
 Bug Type:         Filesystem function related
 Operating System: FC4, 2.6.17
 PHP Version:      5.2.1
 New Comment:

I'm totally lost in your paths,
"/home/chroot/home/krtek/web/tuzemsko/tmp/", which is actually
"/var/www/web/tuzemsko/krtek/web/tuzemsko/tmp" is a bit hard to read
and recreate.
Please provide simple and clear directory structure I need to create in
order to reproduce it.
For example:
/www/tmp - upload dir
/www - scripts dir
etc. etc.


Previous Comments:
------------------------------------------------------------------------

[2007-02-26 12:42:27] stloukal at programator dot cz

Hello,

I don't know, what to fix. I can use the same configuration, the same
symlinks, the same script and when I change the name of the target
directory (e.g. ../../tmp/test/ or ../../temp/) everything works fine
without problems. I don't think the problem is in the symlinks. Even if
I create symlink for "tmp" named "temp" and I use "../../temp" path
instead "../../tmp" path, it works fine.

------------------------------------------------------------------------

[2007-02-26 09:53:58] [EMAIL PROTECTED]

Cannot reproduce.
Fix your symlinks pointing to and out chroots.

------------------------------------------------------------------------

[2007-02-19 12:26:22] stloukal at programator dot cz

Hello,

here is working code that demonstrates described bug. I append some
configuration that may be interesting for you.

Configuration:
Safe mode: off
$_SERVER[SCRIPT_FILENAME]:
/var/www/web/tuzemsko/krtek/admin/gallery_test.php
real path of the script:
/home/chroot/home/krtek/web/tuzemsko/www/admin/gallery_test.php

/var/www/web/tuzemsko/krtek is a symbolic link to
/home/chroot/home/krtek/web/tuzemsko/www/.

httpd.conf:
<Directory "/var/www/web/tuzemsko/krtek">
        php_admin_value upload_tmp_dir /home/chroot/tmp/
        php_admin_value open_basedir
/var/www/web/tuzemsko/krtek/:/home/chroot/tmp/:/home/chroot/home/krtek/web/
</Directory>

Directory /home/chroot/home/krtek/web/tuzemsko/tmp/ has 0777
permissions.

-------------------------------------------------------

Script:
<?php

// *************** UPLOAD FOTKY ***************
if ($_REQUEST['load_pic']) {

        $name = 'galerie_'.$_FILES['soubor']['name'];
        $path = '../../tmp/'.$name;

        echo 'uploaded: '.$_FILES['soubor']['tmp_name'].' =
'.(int)file_exists($_FILES['soubor']['tmp_name']);
        $res = move_uploaded_file($_FILES['soubor']['tmp_name'],
$path);
        echo ' moved: '.$path.' = '.(int)file_exists($path);

}
// *************** UPLOAD FOTKY KONEC ***************

echo '
<form action="'.$_SERVER['PHP_SELF'].'" method="post"
enctype="multipart/form-data">
        <input type="hidden" name="MAX_FILE_SIZE" value="200000" />
        <input type="file" name="soubor" />
        <input type="submit" value="Save" />
        <input type="hidden" name="load_pic" value="true" />
</form>
      ';
?>

Everything worked fine with 5.1.2 version.

------------------------------------------------------------------------

[2007-02-19 10:01:27] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2007-02-19 01:13:39] stloukal at programator dot cz

Description:
------------
Hello,

I have a problem with move_uploaded_file() function which doesn't move
the uploaded file. No errors or warnings are thrown, only false is
returned. Problem occurs only if target directory is RELATIVELY
addressed and it is named "tmp".

It seems, that this is the same problem:
http://bugs.php.net/bug.php?id=32456

Reproduce code:
---------------
$path = '../../tmp/'.$_FILES['soubor']['name']; // this is not the
system tmp directory

echo 'uploaded: '.$_FILES['soubor']['tmp_name'].' =
'.(int)file_exists($_FILES['soubor']['tmp_name']);

move_uploaded_file($_FILES['soubor']['tmp_name'], $path);

echo ' moved: '.$path.' = '.(int)file_exists($path);


Expected result:
----------------
uploaded: /home/chroot/tmp/phpcLIB4C = 1 
moved: ../../tmp/galerie_2001_image001jpg.jpg = 1

Actual result:
--------------
uploaded: /home/chroot/tmp/phpcLIB4C = 1 
moved: ../../tmp/galerie_2001_image001jpg.jpg = 0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40537&edit=1

Reply via email to