php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40606 umask is not being restored when each request is finished. no fixed bug #36630
Submitted: 2007-02-23 15:42 UTC Modified: 2007-02-23 16:22 UTC
From: support at nethost dot cz Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 5.2.1 OS: unix-gentoo
Private report: No CVE-ID:
 [2007-02-23 15:42 UTC] support at nethost dot cz
Description:
------------
>> Bug #36630  	umask is not being restored when each equest is finished. see for details in bug #36630.
  
this bug not fixed successfully, in file.c is bug in 
        if (BG(umask) != -1) {
                BG(umask) = oldumask;
        }
instead 
        if (BG(umask) == -1) {  /* yes == , no != */
                BG(umask) = oldumask;
        }
it fixes, but for clean code i move initializing 
BG(umask) = -1; from basic_globals_ctor to PHP_RINIT_FUNCTION(basic)   (finalizing is in PHP_RSHUTDOWN_FUNCTION(basic))

this bug is only for sapi apache2 handler-module (apache1 has workaround in sapi code). Or may implement same workaround in apache2 handler module.

i try daily snapshot, and last version, all is bad fixed. after fixing all is ok for testing code 
<?=echo sprintf("%04o",umask(0111));?>



Reproduce code:
---------------
<?=echo sprintf("%04o",umask(0111));?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-23 15:54 UTC] tony2001@php.net
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-23 15:57 UTC] support at nethost dot cz
code is same as for bug 36630, as below, simple, but functional, 
<?=echo sprintf("%04o",umask(0111));?>
expected result is (with default umask 070)
0070
0070
0070
and not
0070
0070
0070
0111
0070
0111  - there is used same process
 [2007-02-23 16:22 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 12:01:59 2014 UTC