10000 few optimisations for XliffFileLoader and XmlFileLoader · sdboyer/symfony@8d50c16 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d50c16

Browse files
committed
few optimisations for XliffFileLoader and XmlFileLoader
1 parent 41b25a4 commit 8d50c16

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ private function validateSchema(\DOMDocument $dom, $file)
326326
$imports = '';
327327
foreach ($schemaLocations as $namespace => $location) {
328328
$parts = explode('/', $location);
329-
if (preg_match('#^phar://#i', $location)) {
329+
if (0 === stripos($location, 'phar://')) {
330330
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
331331
if ($tmpfile) {
332-
file_put_contents($tmpfile, file_get_contents($location));
332+
copy($location, $tmpfile);
333333
$tmpfiles[] = $tmpfile;
334334
$parts = explode('/', str_replace('\\', '/', $tmpfile));
335335
}

src/Symfony/Component/Translation/Loader/XliffFileLoader.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ private function parseFile($file)
5858

5959
$location = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd';
6060
$parts = explode('/', $location);
61-
if (preg_match('#^phar://#i', $location)) {
61+
if (0 === stripos($location, 'phar://')) {
6262
$tmpfile = tempnam(sys_get_temp_dir(), 'sf2');
6363
if ($tmpfile) {
64-
file_put_contents($tmpfile, file_get_contents($location));
65-
$tmpfiles[] = $tmpfile;
64+
copy($location, $tmpfile);
6665
$parts = explode('/', str_replace('\\', '/', $tmpfile));
6766
}
6867
}

0 commit comments

Comments
 (0)
0