From:             oscar dot de dot lathouder at gmail dot com
Operating system: Fedora Core 5
PHP version:      5.1.4
PHP Bug Type:     Directory function related
Bug description:  mkdir recursive creates wrong owner for parent directories

Description:
------------
The recursive option of mkdir() creates wrong owners for created parents.







Reproduce code:
---------------
Executed file:
-rw-rw-rw- 1 thisuser mygoup  5900 Jun 28 09:32 test.php

saveLocation:
/mnt/shared/

ls -al /mnt/shared/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxr-xr-x 5 root     root     4096 Jun 23 15:11 ..
(note: server is MS Windows 2000 server, executing server is Fedora Core
5. 'thisuser' has read/write permissions on server as well)

Code:
$saveLocation = /mnt/shared/1/2/3/
if (!file_exists($saveLocation) && !is_dir($saveLocation))
mkdir($saveLocation,0777,true);



Expected result:
----------------
ls -al /mnt/shared/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxr-xr-x 5 root     root     4096 Jun 23 15:11 ..
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 1

ls -al /mnt/shared/1/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 ..
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 2

ls -al /mnt/shared/1/2/
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 .
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 ..
drwxrwxrwx 1 thisuser mygroup     0 Jun 28 09:21 3


Actual result:
--------------
ls -al /mnt/shared/
drwxrwxrwx 1 thisuser  mygroup    0 Jun 28  2006 .
drwxr-xr-x 5 root         root 4096 Jun 23 15:11 ..
drwxrwxrwx 1 root         root    0 Jun 28  2006 1

ls -al /mnt/shared/1/
drwxrwxrwx 1 root         root    0 Jun 28  2006 .
drwxrwxrwx 1 thisuser  mygroup    0 Jun 28  2006 ..

Errorlog:
[Wed Jun 28 10:58:43 2006] [error] [client xx.xx.xx.xx] PHP Warning: 
mkdir() [<a href='function.mkdir'>function.mkdir</a>]: Permission denied
in /var/www/html/test.php on line 2, referer: http://xx.xx.xx.xx/test.php

When I execute the same script again, it will create another directory
(2), but exits with the same error.

-- 
Edit bug report at http://bugs.php.net/?id=37946&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37946&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37946&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37946&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37946&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37946&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37946&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37946&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37946&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37946&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37946&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37946&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37946&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37946&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37946&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37946&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37946&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37946&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37946&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37946&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37946&r=mysqlcfg

Reply via email to