Problem in phar see mergerequest #25579
This commit is contained in:
parent
4bd9c79e93
commit
3e0c8ffb43
@ -458,16 +458,20 @@ class XmlFileLoader extends FileLoader
|
|||||||
$imports = '';
|
$imports = '';
|
||||||
foreach ($schemaLocations as $namespace => $location) {
|
foreach ($schemaLocations as $namespace => $location) {
|
||||||
$parts = explode('/', $location);
|
$parts = explode('/', $location);
|
||||||
|
$locationstart = 'file:///';
|
||||||
if (0 === stripos($location, 'phar://')) {
|
if (0 === stripos($location, 'phar://')) {
|
||||||
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
|
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
|
||||||
if ($tmpfile) {
|
if ($tmpfile) {
|
||||||
copy($location, $tmpfile);
|
copy($location, $tmpfile);
|
||||||
$tmpfiles[] = $tmpfile;
|
$tmpfiles[] = $tmpfile;
|
||||||
$parts = explode('/', str_replace('\\', '/', $tmpfile));
|
$parts = explode('/', str_replace('\\', '/', $tmpfile));
|
||||||
|
} else {
|
||||||
|
array_shift($parts);
|
||||||
|
$locationstart = 'phar:///';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||||
$location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
|
$location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||||
|
|
||||||
$imports .= sprintf(' <xsd:import namespace="%s" schemaLocation="%s" />'."\n", $namespace, $location);
|
$imports .= sprintf(' <xsd:import namespace="%s" schemaLocation="%s" />'."\n", $namespace, $location);
|
||||||
}
|
}
|
||||||
|
@ -129,15 +129,19 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
|
|
||||||
$location = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd';
|
$location = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd';
|
||||||
$parts = explode('/', $location);
|
$parts = explode('/', $location);
|
||||||
|
$locationstart = 'file:///';
|
||||||
if (0 === stripos($location, 'phar://')) {
|
if (0 === stripos($location, 'phar://')) {
|
||||||
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
|
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
|
||||||
if ($tmpfile) {
|
if ($tmpfile) {
|
||||||
copy($location, $tmpfile);
|
copy($location, $tmpfile);
|
||||||
$parts = explode('/', str_replace('\\', '/', $tmpfile));
|
$parts = explode('/', str_replace('\\', '/', $tmpfile));
|
||||||
|
} else {
|
||||||
|
array_shift($parts);
|
||||||
|
$locationstart = 'phar:///';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||||
$location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts));
|
$location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||||
|
|
||||||
$source = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd');
|
$source = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd');
|
||||||
$source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source);
|
$source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source);
|
||||||
|
Reference in New Issue
Block a user