Bug #491

FLOW3 not working under Windows

Added by Christoph Blömer about 7 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2008-05-08
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Resource
Target version:- Estimated time:0.00 hour
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

After Revision 784 I get this StackTrace under Windows Vista.
I also checked it on Ubuntu 8.04. It works on Linux.

So because the Core Developers "only" have a Mac Book I post it here ;-)

On Windows Vista I get a "500 Internal Server Error" when I use index.php and following StackTrace when I use index_dev.php:

Warning: mkdir() [function.mkdir]: Invalid argument in D:\xampp\htdocs\demo\Packages\FLOW3\Classes\Utility\F3_FLOW3_Utility_Files.php line 112

F3_FLOW3_Error_Exception thrown in file
D:\xampp\htdocs\demo\Packages\FLOW3\Classes\Error\F3_FLOW3_Error_ErrorHandler.php in line 87.

6 F3_FLOW3_Error_ErrorHandler::handleError(2, "mkdir() [<a href='fu…>]: Invalid argume", "D:\xampp\htdocs\demo…W3_Utility_Files.p", 112, array)

D:\xampp\htdocs\demo\Packages\FLOW3\Classes\Utility\F3_FLOW3_Utility_Files.php:

00110: if (!is_dir($currentPath) && F3_PHP6_Functions::strlen($directoryName) > 0) {
00111: $oldMask = umask(000);
00112: mkdir($currentPath, 0777);
00113: umask($oldMask);
00114: if (!is_dir($currentPath)) throw new F3_FLOW3_Utility_Exception('Could not create directory "' . $path . '"!', 1170251400);

5 F3_FLOW3_Utility_Files::createDirectoryRecursively("D:/xampp/htdocs/demo…docs\demo\Packages", 511)

D:\xampp\htdocs\demo\Packages\FLOW3\Classes\Resource\F3_FLOW3_Resource_Publisher.php:
00155: $metadata = $this->extractResourceMetadata($URI);
00156:
00157: F3_FLOW3_Utility_Files::createDirectoryRecursively($destinationPath . dirname($relativeFile));
00158: if($metadata['mimeType'] == 'text/html') {
00159: $HTML = F3_FLOW3_Resource_Processor::adjustRelativePathsInHTML(file_get_contents($file), 'Resources/' . $packageName . '/Public/' . dirname($relativeFile) . '/');

4 F3_FLOW3_Resource_Publisher::mirrorPublicPackageResources("D:/xampp/htdocs/demo…Resources/Public\C")

D:\xampp\htdocs\demo\Packages\FLOW3\Classes\F3_FLOW3.php:
00271: $activePackages = $packageManager->getActivePackages();
00272: foreach ($activePackages as $packageKey => $package) {
00273: $resourcePublisher->mirrorPublicPackageResources($packageKey);
00274: }
00275:

patch_windows_flow3_bug_491.diff Magnifier (2 kB) Tim Eilers, 2008-05-09 23:53

patch_windows_flow3_bug_491_alternative.diff Magnifier (1.9 kB) Tim Eilers, 2008-05-10 00:32

FLOW3_491_v1_Backslashes_in_Path.patch Magnifier (2.1 kB) Malte Jansen, 2008-05-10 10:36

FLOW3_491_v2_Backslashes_in_Path.patch Magnifier (2.1 kB) Malte Jansen, 2008-05-10 10:41


Related issues

related to TYPO3.Flow - Task #497: Remove createDirectoryRecursively() and replace by recurs... Resolved 2008-05-09

Associated revisions

Revision 18450f59
Added by Karsten Dambekalns about 7 years ago

Added a new method to F3_FLOW3_Utility_Files to convert a path to unix style and using that in some places. This fixes #491, we hope. Thanks to Tim and Malte for helping with this.

History

#1 Updated by Tim Eilers about 7 years ago

its not only a vista only problem. i do have exactly the same on windows xp (with xampp).

it would really be nice if the exception catcher prints out parameters full, not shortened! i noticed that several times.

#2 Updated by Tim Eilers about 7 years ago

After long way of bug searching i found out that:
Windows is to lazy to create dirs recursively, so in my opinion every "mkdir" call in whole FLOW3 needs parameter recursive set to true, at least in F3_FLOW3_Utility_Files.php, line 112 (which is the only point where mkdir is used in FLOW3 at the moment):

                mkdir($currentPath, 0777, TRUE);

it doesn't hurt on linux based systems (not tested yet) and makes it work under windows.

another bigger problem is the occurence of "C:\", creating pathes like "C:/xampp/htdocs/FLOW3/Public/Resources/ExtJS/Public/C:\xampp\htdocs\FLOW3\Packag...." will definitly not work!
don't know how to fix that in a nice way. i think windows should be supported. i hope with a bit work in F3_FLOW3_Resource_Publisher (function mirrorPublicPackageResources) this can be solved. But now i need sleep, good night! :)

#3 Updated by Karsten Dambekalns about 7 years ago

  • Status changed from New to Needs Feedback

#497 changed the mkdir use in F3_FLOW3_Utility_Files, please check if that helps (partly).

#4 Updated by Karsten Dambekalns about 7 years ago

  • Status changed from Needs Feedback to Accepted

Still open, the mkdir() change did not solve it, as reported by Tim Eilers.

#5 Updated by Tim Eilers about 7 years ago

the mkdir change is ok, that should resist.

i did some very little changes which solve the problem nearly (see patch in attachment). but there is still a problem on the first dry run with clean Temp and clean Public folder which sounds like this:

Warning: mkdir() [function.mkdir]: File exists in C:\xampp\htdocs\FLOW3\Packages\FLOW3\Classes\Utility\F3_FLOW3_Utility_Files.php line 107 

while trying to create:
C:/xampp/htdocs/FLOW3/Public/Resources/TestPackage/Public/.

i believe some "is_dir" check fails somewhere, but can't see it where...

#6 Updated by Tim Eilers about 7 years ago

i created an alternative patch, which cares for the "forward slash everywhere" (see attachment).
but the "File exists" problem is still there on the first call with clean caches/tempdirs.

#7 Updated by Malte Jansen about 7 years ago

Not just the backslashes must be replaced, but also the double slashes (to be comparable).

I have created a function for it, because it's used there several times. At this place there is not CM, so the funciton must be located in the F3_FLOW3 as static.

public static function getUnixStylePath($path) {
    return str_replace('//', '/', str_replace('\\', '/', $path));
}

#8 Updated by Malte Jansen about 7 years ago

Just one a spelling mistake...

#9 Updated by Tim Eilers about 7 years ago

@Malte
good idea. but i looked at the patch and wondered, why you aren't using the function in F3_FLOW3_Utility_Files? (in your patch there is still a str_replace)

#10 Updated by Karsten Dambekalns about 7 years ago

  • Subject changed from FLOW3 not working under Windows Vista. to FLOW3 not working under Windows

#11 Updated by Karsten Dambekalns about 7 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r829.

Also available in: Atom PDF