Fixed bugs

This commit is contained in:
2026-06-19 16:40:37 +00:00
parent 0027766a77
commit 01fae418de
3 changed files with 9 additions and 9 deletions
+6 -6
View File
@@ -75,8 +75,8 @@ class ClassRepository {
public function getCustomFilesCachePath(Node $object) { public function getCustomFilesCachePath(Node $object) {
$path = $this->options['cache_dir'].DIRECTORY_SEPARATOR $path = $this->options['cache_dir'].DIRECTORY_SEPARATOR
.strtoupper(md5($object->getId())).DIRECTORY_SEPARATOR .strtoupper(md5($object->getId())).DIRECTORY_SEPARATOR
.($object->getProperty(ObjectRetriever::REVISION_PROPERTY) .($object->getProperty(Constants::PROPERTY_REVISION)
? $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue() ? $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
: 'LocalConfig'); : 'LocalConfig');
if (!is_dir($path)) mkdir($path, 0777, true); if (!is_dir($path)) mkdir($path, 0777, true);
return $path; return $path;
@@ -87,8 +87,8 @@ class ClassRepository {
$vars = $this->getURIVars($uri); $vars = $this->getURIVars($uri);
// Fetch class description // Fetch class description
$revision = $object->getProperty(ObjectRetriever::REVISION_PROPERTY) $revision = $object->getProperty(Constants::PROPERTY_REVISION)
? $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue() ? $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
: 'LocalConfig'; : 'LocalConfig';
// Clear cache if cached version exists // Clear cache if cached version exists
@@ -243,8 +243,8 @@ class ClassRepository {
$objectRetriever = $this->container->get(ObjectRetriever::class); $objectRetriever = $this->container->get(ObjectRetriever::class);
// Get revision // Get revision
$revision = $object->getProperty(ObjectRetriever::REVISION_PROPERTY) $revision = $object->getProperty(Constants::PROPERTY_REVISION)
? $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue() ? $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
: 'LocalConfig'; : 'LocalConfig';
// Build filename where cached version should exist // Build filename where cached version should exist
+2 -2
View File
@@ -9,7 +9,7 @@ namespace CloudObjects\PhpMAE;
use Slim\Psr7\Response; use Slim\Psr7\Response;
use Slim\ResponseEmitter; use Slim\ResponseEmitter;
use ML\JsonLD\Node; use ML\JsonLD\Node;
use CloudObjects\SDK\ObjectRetriever; use CloudObjects\SDK\ObjectRetriever, CloudObjects\SDK\Constants;
class ErrorHandler { class ErrorHandler {
@@ -22,7 +22,7 @@ class ErrorHandler {
$message = substr($error['message'], 0, strpos($error['message'], ' in /')); $message = substr($error['message'], 0, strpos($error['message'], ' in /'));
$response = (new Response(500))->withHeader('Content-Type', 'text/plain'); $response = (new Response(500))->withHeader('Content-Type', 'text/plain');
$response->getBody()->write("Error in implementation of <".$object->getId()."> at revision " $response->getBody()->write("Error in implementation of <".$object->getId()."> at revision "
. $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue() . $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
. ":\n".$message); . ":\n".$message);
return $response; return $response;
}); });
@@ -49,7 +49,7 @@ class CustomizedValidatorVisitor extends NodeVisitorAbstract {
*/ */
public function leaveNode(Node $node){ public function leaveNode(Node $node){
if($node instanceof Node\Arg && $this->sandbox->sandbox_strings){ if($node instanceof Node\Arg && $this->sandbox->sandbox_strings){
return new Node\Expr\FuncCall(new Node\Name\FullyQualified(($node->value instanceof Node\Expr\Variable) ? 'PHPSandbox\\wrapByRef' : 'PHPSandbox\\wrap'), [$node, new Node\Expr\StaticCall(new Node\Name\FullyQualified("PHPSandbox\\PHPSandbox"), 'getSandbox', [new Node\Arg(new Node\Scalar\String_($this->sandbox->name))])], $node->getAttributes()); return new Node\Expr\FuncCall(new Node\Name\FullyQualified(($node->value instanceof Node\Expr\Variable) ? 'PHPSandbox\\wrapByRef' : 'PHPSandbox\\wrap'), [$node, new Node\Expr\StaticCall(new Node\Name\FullyQualified("CloudObjects\\PhpMAE\\Sandbox\\CustomizedSandbox"), 'getGlobalSandbox')], $node->getAttributes());
} else if($node instanceof Node\Stmt\InlineHTML){ } else if($node instanceof Node\Stmt\InlineHTML){
if(!$this->sandbox->allow_escaping){ if(!$this->sandbox->allow_escaping){
$this->sandbox->validationError("Sandboxed code attempted to escape to HTML!", Error::ESCAPE_ERROR, $node); $this->sandbox->validationError("Sandboxed code attempted to escape to HTML!", Error::ESCAPE_ERROR, $node);