Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added better log viewing #1303

Merged
merged 13 commits into from
Feb 13, 2025
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