8000 merged branch stealth35/trans_few_op (PR #2093) · sdboyer/symfony@e0a3605 · GitHub
[go: up one dir, main page]

Skip to content

Commit e0a360 8000 5

Browse files
committed
merged branch stealth35/trans_few_op (PR symfony#2093)
Commits ------- 8d50c16 few optimisations for XliffFileLoader and XmlFileLoader Discussion ---------- few optimisations for XliffFileLoader and XmlFileLoader - file_put_contents + file_get_contents -> copy - use stripos insteed preg_match - removed useless `$tmpfiles` in XliffFileLoader
2 parents 63db235 + 8d50c16 commit e0a3605

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