Align Core\View namespaces and close remaining production blockers in escaping/cache semantics#4
Draft
Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix critical bugs in view engine for production readiness
Align Jun 3, 2026
Core\View namespaces and close remaining production blockers in escaping/cache semantics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This issue tracks production-readiness gaps in the view engine (critical runtime breaks, security/safety concerns, and config behaviors not being honored). This PR addresses the remaining blockers in this branch around namespace correctness, expression escaping behavior, and cache expiration semantics.
Namespace correctness (
src/-rooted)Beobles\Core\View\...withCore\View\...across the codebase.Core\\View\\so class resolution matches repository structure.Compiler behavior:
auto_escapeis now effectiveCompilernow receivesautoEscapeconfig.compileExpressionNode()conditionally emits escaped vs raw output based on config.Enginenow wiresEnvironmentauto_escapeintoCompiler.Cache TTL behavior fixed
FileCacheAdapter::set()now persists payload metadata (value,expires_at).FileCacheAdapter::get()now enforces expiration and evicts stale entries.Original prompt
Correção Crítica - View Engine Production Ready
🚨 Problemas Críticos Identificados
A análise profunda da codebase identificou 20 bugs graves que impedem o funcionamento correto do template engine. Esta PR corrige todos eles.
🔴 CRÍTICO (Bloqueadores)
class_basename()undefinedCompiler.php:36usa função que não existeExpressões compilam SEM
$echo $__engine->escape(title ?? "", 'html');echo $__engine->escape($title ?? "", 'html');{{ }}Control flow incompleto
Ifcompilaif ($cond) {mas nunca fecha}Foreachcompilaforeach (...) {mas nunca fecha}Block buffering quebrado
<Block>compilaob_start();sem nunca chamarob_get_clean()Eval() risco de segurança
Renderer.php:27executa código comeval()🟠 ALTO (Graves)
Lexer quebra em
>dentro atributos([^>]*)termina em>dentro string<Component attr="{{ x > 5 }}" />tokeniza erradoParser parseAttributes regex errada
Else/ElseIf não implementadas
Layout/Inheritance não funciona
extends "layout.html"tokenizada como KEYWORDparseKeyword()é stub que retorna nullPath traversal vulnerability
resolveTemplatePath()concatena sem normalization../../../etc/passwdpode funcionarrealpath()+ verificaçãoCache nunca expira
Middleware não existe
SecurityMiddleware,CacheMiddleware,ProfilingMiddleware🟡 MÉDIO
| uppercasenever parsed/appliedreverseregistered twice, behavior unclearExceptionnotThrowable🔵 BAIXO
📋 Correções Implementadas
1. Namespace Fix
Aplicado em todos os arquivos.
2. Core Compilation Fixes
Compiler.php:
class_basename()- usarget_class()$em variáveis simples:{{ title }}→$titleuser.name→$user['name']| uppercase→ aplicação de filtroParser.php:
parseKeyword()para extends/importparseAttributes()regexLexer.php:
>em strings)</If>,</Foreach>,</Block>)3. Scope & Expression Handling
ExpressionNode (novo):
user.name→['name']items[0]→[0]user.getName()→->getName()| uppercase→ função de filtro$prefix4. Security & Validation
TemplateValidator (novo):
Escaper context-aware:
eval()do Renderer5. Middleware Removal
Se classes não existem propositalmente:
6. Code Clea...
This pull request was created from Copilot chat.