#28401 [WFx]: umask is not being restored when each request is finished.
| From: | todd at stew dot org | Date: | Fri, 14 May 2004 17:34:33 +0000 |
| Subject: | #28401 [WFx]: umask is not being restored when each request is finished. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59640@lists.php.net to get a copy of this message | ||
ID: 28401
User updated by: todd at stew dot org
Reported By: todd at stew dot org
Status: Wont fix
Bug Type: Apache2 related
Operating System: Redhat 9 and Fedora
PHP Version: 4.3.6
New Comment:
The docs say:
umask() sets PHP's umask to mask & 0777 and returns the old umask. When
PHP is being used as a server module, the umask is restored when each
request is finished.
Using apache 1.3 does not have the same problem.
Can you suggest a workaround?
adding a auto_prepend_file or an auto_append_file works unless there is
another declaration in a .htaccess file, then it does not work.
Previous Comments:
------------------------------------------------------------------------
[2004-05-14 17:24:09] iliaa@php.net
Fixing this bug would require adding an internal global to
PHP which would break backwards compatibility for binary
modules. Consequently this cannot be fixed in 4.3.X tree.
------------------------------------------------------------------------
[2004-05-14 16:43:32] todd at stew dot org
Description:
------------
The apache child's umask is reset and not restored.
This behavior is present in
the redhat php-4.2.2-17.2 rpm, my custom install of 4.3.4 and my custom
install of 4.3.6 (compiled yesterday). It happens with both apache
2.0.40 and 2.0.48.
Reproduce code:
---------------
create a cgi file that touches a random filename and lists that file;
#!/bin/bash
echo "content-type: text/plain"
echo
touch /tmp/$UNIQUE_ID
ls -ald /tmp/$UNIQUE_ID
create a php file that sets a umask
<?
umask(077);
?>
Set apache to only spawn one child.
hit the cgi file then hit the php file then hit the cgi file.
Expected result:
----------------
The umask should not change for the cgi's and should only change for
the php script.
Actual result:
--------------
The umask remains sticky to the apache child.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28401&edit=1