Skip to content

Commit da723fe

Browse files
Boris Betzholzfabpot
authored andcommitted
Problem in phar see mergerequest #25579
1 parent af7f611 commit da723fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Loader/XliffFileLoader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,19 @@ private function parseFile($file)
129129

130130
$location = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd';
131131
$parts = explode('/', $location);
132+
$locationstart = 'file:///';
132133
if (0 === stripos($location, 'phar://')) {
133134
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
134135
if ($tmpfile) {
135136
copy($location, $tmpfile);
136137
$parts = explode('/', str_replace('\\', '/', $tmpfile));
138+
} else {
139+
array_shift($parts);
140+
$locationstart = 'phar:///';
137141
}
138142
}
139143
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
140-
$location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
144+
$location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
141145

142146
$source = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd');
143147
$source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source);

0 commit comments

Comments
 (0)