Skip to content

Commit

Permalink
#6: Can't open affix or dictionary files for dictionary named "default".
Browse files Browse the repository at this point in the history
Fixed for Symfony < 3.2
  • Loading branch information
mekras committed Mar 22, 2017
1 parent 54063f0 commit c2a944f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/ExternalSpeller.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ public function __construct($binaryPath)
public function checkText(Source $source, array $languages)
{
$process = $this->createProcess($this->createArguments($source, $languages));
$process->setEnv($this->createEnvVars($source, $languages));
if (method_exists($process, 'inheritEnvironmentVariables')) {
// Symfony 3.2+
$process->setEnv($this->createEnvVars($source, $languages));
} else {
// Symfony < 3.2
$process->setEnv(
array_merge($process->getEnv(), $this->createEnvVars($source, $languages))
);
}

/** @noinspection PhpParamsInspection */
$process->setInput($source->getAsString());
Expand Down Expand Up @@ -224,7 +232,13 @@ protected function createProcess($args = null)
} catch (RuntimeException $e) {
throw new ExternalProgramFailedException($command, $e->getMessage(), 0, $e);
}
$process->inheritEnvironmentVariables(true);
if (method_exists($process, 'inheritEnvironmentVariables')) {
// Symfony 3.2+
$process->inheritEnvironmentVariables(true);
} else {
// Symfony < 3.2
$process->setEnv(['LANG' => getenv('LANG')]);
}
$process->setTimeout($this->timeout);

return $process;
Expand Down

0 comments on commit c2a944f

Please sign in to comment.