php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73930 WinCache prevents directory rename
Submitted: 2017-01-14 08:32 UTC Modified: 2017-11-05 04:22 UTC
From: the dot bitpoet at gmail dot com Assigned: ericsten (profile)
Status: No Feedback Package: WinCache (PECL)
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-01-14 08:32 UTC] the dot bitpoet at gmail dot com
Description:
------------
I've repeatedly and reproducibly experienced a problem with WinCache preventing the renaming of directories once a PHP script inside them has been accessed. This becomes apparent when trying to install the ProcessWire CMS (download from processwire.com, any release). In one of the last steps, the selected site profile folder ("site-blank", "site-basic", etc.) is renamed to "site" by the installer script that pulls information from the PHP scripts within each profile directory. Renaming the directory fails with a write error if WinCache is active. Without WinCache, the step completes fine.

I have encountered this with WinCache 1.3 and 2.0, with PHP versions 5.6 and 7.0, on different IIS versions, all using FastCGI and NTS builds.

I've found bug #5935 which sounds similar but should have been fixed a long time ago, so it might or might not be a regression.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-23 17:12 UTC] krakjoe@php.net
-Assigned To: +Assigned To: ericsten
 [2017-02-03 22:45 UTC] ericsten@php.net
I've attempted to repro the problem with a minimal script, and so far, have been unable to repro the issue.  With both WinCache enabled or disabled, the scripts below succeed

Steps:
1. ren_foobar.php
2. read_tmp_simple.php
3. [repeat 1 & 2 ad infinitum]

Scripts used to try and repro the problem:
[ren_foobar.php]
<?php

$base_dir = sys_get_temp_dir() . '/banana';

if (!file_exists($base_dir))
{
    echo "Creating directory: " . $base_dir . " ...";

    mkdir($base_dir);
    mkdir($base_dir . '/foo');

    echo "Creating content...";
    file_put_contents($base_dir . "/foo/zz.txt", "Example Text");
    file_put_contents($base_dir . "/xx.txt", "Hello world!");
}

echo "Renaming directory...";

if (file_exists($base_dir . "/foo"))
{
    echo " /foo ";
    var_dump(rename($base_dir . "/foo", $base_dir ."/bar"));
} 
else if (file_exists($base_dir . "/bar"))
{
    echo " /bar ";
    var_dump(rename($base_dir . "/bar", $base_dir ."/foo"));
}

echo "Renaming file...";

if (file_exists($base_dir . "/xx.txt"))
{
    echo " xx.txt -> yy.txt ";
    var_dump(rename($base_dir . "/xx.txt", $base_dir . "/yy.txt"));
}
else if (file_exists($base_dir . "/yy.txt"))
{
    echo " yy.txt -> xx.txt ";
    var_dump(rename($base_dir . "/yy.txt", $base_dir . "/xx.txt"));
}

?>

[read_tmp_simple.php]
<?php

$base_dir = sys_get_temp_dir() . '/banana';

echo "Getting zz.txt.php...";

if (file_exists($base_dir . "/foo"))
{
    echo $base_dir . "/foo";
    var_dump(file_get_contents($base_dir . "/foo/zz.txt"));
} 
else if (file_exists($base_dir . "/bar"))
{
    echo $base_dir . "/bar";
    var_dump(file_get_contents($base_dir . "/bar/zz.txt"));
}


if (file_exists($base_dir . "/xx.txt"))
{
    echo "Getting xx.txt...";
    var_dump(file_get_contents($base_dir . "/xx.txt"));
}
else if (file_exists($base_dir . "/yy.txt"))
{
    echo "Getting yy.txt...";
    var_dump(file_get_contents($base_dir . "/yy.txt"));
}

?>
 [2017-10-24 07:09 UTC] kalle@php.net
-Status: Assigned +Status: Feedback
 [2017-11-05 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jan 18 22:01:22 2020 UTC