Skip to content

Commit

Permalink
Merge pull request #37 from EtienneBruines/master
Browse files Browse the repository at this point in the history
Updated require_once statement to valid php syntax
  • Loading branch information
DarkGhostHunter committed May 28, 2020
2 parents f467db7 + 679862c commit 8b7fd69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PreloaderCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function compile() : string
'@output' => $this->scriptRealPath(),
'@generated_at' => date('Y-m-d H:i:s e'),
'@autoload' => isset($this->autoloader)
? 'require_once ' . realpath($this->autoloader) : null,
? 'require_once \'' . realpath($this->autoloader) . '\';': null,
'@list' => $this->parseList(),
'@mechanism' => $this->useRequire
? 'require_once $file' : 'opcache_compile_file($file)',
Expand Down
6 changes: 4 additions & 2 deletions tests/PreloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,11 @@ public function test_uses_require_instead_of_compile()

$contents = file_get_contents($this->preloaderPath);

$this->assertStringContainsString('require_once ' . realpath(implode(DIRECTORY_SEPARATOR, [
$path = realpath(implode(DIRECTORY_SEPARATOR, [
$this->workdir, 'autoload.php'
])), $contents);
]));
$expectedRequire = "require_once '$path';";
$this->assertStringContainsString($expectedRequire, $contents);
$this->assertStringContainsString('require_once $file', $contents);
}

Expand Down

0 comments on commit 8b7fd69

Please sign in to comment.