Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions modules/cms/classes/CodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,16 @@ protected function rebuild($path)
$fileContents .= trim($body).PHP_EOL;
$fileContents .= '}'.PHP_EOL;

$this->validate($fileContents);

$this->makeDirectorySafe(dirname($path));

$this->writeContentSafe($path, $fileContents);

// Attempt to load the generated code file to ensure any errors are thrown
// before the file is cached
if (!class_exists($className)) {
require_once $path;
}

return $className;
}

Expand Down Expand Up @@ -289,15 +293,6 @@ protected function getCachedFileInfo()
// Helpers
//

/**
* Evaluates PHP content in order to detect syntax errors.
* The method handles PHP errors and throws exceptions.
*/
protected function validate($php)
{
eval('?>'.$php);
}

/**
* Extracts the class name from a cache file
* @return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
var ExceptionBeautifier = $.fn.exceptionBeautifier.Constructor

ExceptionBeautifier.EDITORS = {
vscode: {scheme: 'vscode://file/%file:%line', name: 'VS Code (vscode://)'},
phpstorm: {scheme: 'phpstorm://open?file=%file&line=%line', name: 'PhpStorm (phpstorm://)'},
subl: {scheme: 'subl://open?url=file://%file&line=%line', name: 'Sublime (subl://)'},
txmt: {scheme: 'txmt://open/?url=file://%file&line=%line', name: 'TextMate (txmt://)'},
mvim: {scheme: 'mvim://open/?url=file://%file&line=%line', name: 'MacVim (mvim://)'},
phpstorm: {scheme: 'phpstorm://open?file=%file&line=%line', name: 'PhpStorm (phpstorm://)'},
editor: {scheme: 'editor://open/?file=%file&line=%line', name: 'Custom (editor://)'}
}

Expand Down
Loading
Loading