Framework

Repository Author Commit message Committed SHA  
 
latte by dg updated upgrading.md
latte by dg Runtime: added TrustedUrl, which is not checked in URL attributes

A URL in href, src and other URL attributes is checked by checkUrl() and the
only way around was |nocheck in the template, which turns the check off for the
place whatever the value is. TrustedUrl moves the decision to the PHP code that
creates the URL, e.g. one with a scheme of its own. It is not a content type:
anywhere else it is escaped like any other value.

90f5fdcf-a97a-42b5-bc27-65b36db215de

latte by dg FilterExecutor: contextual filters get TrustedJavaScript, TrustedCss & TrustedXml as a string of their type

A contextual filter in a print, {$js|trim}, got an HTML object as a string with
the content type html and its result was wrapped back; the other trusted types
were passed as objects of an unknown type. They are now treated the same way:
the filter gets the string with the type js, css or xml and the result becomes
the trusted class of the type the filter left.

The class of a content type and the type of a trusted object are mapped in
Helpers::getTrustedClass() and getTrustedType() only.

90f5fdcf-a97a-42b5-bc27-65b36db215de

latte by dg Engine: added renderToTrusted()

Returns the output as the trusted object of the content type it really has,
which removes the trap of new Html($latte->renderToString(...)), where nobody
checks that the output is HTML.

The type comes from the template that printed the output, which with {layout}
is the last one of the chain, so Template::render() returns it. A single block
has the type of the place it is defined in: a block in <script> gives
TrustedJavaScript, in <style> TrustedCss, a block in <title>, <textarea> or an
attribute is converted to HTML. A text or iCal template and a block without
a conversion to its main type (a comment, on*) throw.

90f5fdcf-a97a-42b5-bc27-65b36db215de

latte by dg Helpers: printing an HTML object where its escaping differs from its conversion is deprecated

TrustedHtml and other HtmlStringable objects are still printed by the escapers
themselves. Where that differs from converting content type HTML into the
context, the output stays and E_USER_DEPRECATED announces the change:

- style, <style>, a CSS template, inside a tag, <script> of an unknown type
and iCal have no conversion from HTML and will throw,
- a text template keeps the markup and onclick={$html} turns its text into
code; both will be converted like included HTML.

In XML an HTML object is printed as XML, which {capture} relies on, so it is
not deprecated there.

90f5fdcf-a97a-42b5-bc27-65b36db215de

latte by dg added TrustedJavaScript, TrustedCss & TrustedXml, printed like an included template of their type

Every printed value has a content type and printing converts it into the
context: a string is text, a trusted object has the type of its class and goes
through the same convertor as {include} of a template of that type. In its own
context it is printed unchanged (</script and </style are neutralized, an
attribute is encoded), elsewhere it is converted, and where no convertor exists
it throws: TrustedCss printed into JS is an error of type, not a value to escape.

The compiled print tests the type itself and names its context, so strings pay
a single is_object(). Dynamic attributes and n:attr convert inside their
formatters; JS attributes got the formatter formatJsAttribute() for that.

90f5fdcf-a97a-42b5-bc27-65b36db215de

latte by dg Runtime: Html renamed to TrustedHtml

90f5fdcf-a97a-42b5-bc27-65b36db215de

latte by dg TagParser: parseCallArguments() replaced by NodeHelpers::checkArgumentOrder() (BC break)

The name promised the rules of a PHP call, which the arguments of {include}
and the other tags passing variables to a template no longer follow, as
unpacking may stand anywhere. The tags parse the arguments as any other and
check their order separately:

$node->args = $tag->parser->parseArguments();
NodeHelpers::checkArgumentOrder($node->args);

c01493da-8e95-4462-be17-bff3d6fd35fd

application by dg Component: StatePersistent component that is not UI\Component cannot be added (BC break)

Its state was silently skipped by Presenter::getGlobalState().

application by dg Control: flashMessage() does not create the template

In the most typical flow - flashMessage() followed by redirect() - the template
was created just to be thrown away, which builds a whole Latte\Engine instance.
The messages are written to the session first and into the template only if it
already exists; a template created later gets them from the template factory,
which reads the flashes from the session on its own.

application by dg Presenter::argsToParams() now distinguish between NULL and ''
application by dg removed {templatePrint}
application by dg uses nette/routing 4.0
application by dg removed support for @annotations (BC break)
application by dg Presenter: removed constructor (BC break!)
application by dg Component: only UI components can be added to presenter/component (BC break) WIP
application by dg Component: method checkRequirements() is called for createComponent<Name>() methods (BC break)
application by dg Revert "UI\PresenterComponent: removed references created by loadState() for persistent parameters. [Closes nette/nette#703][Closes nette/nette#703][Closes #69]" (possible BC break)

This reverts commit cda17f460d020b0f042364d4e140742022a7e94d.

See https://forum.nette.org/cs/35528-stejne-pojmenovany-parametr-akce-presenteru-a-persistentni-odlisne-chovani-v-nette-2-0-oproti-aktualnimu#p221742

BC break: Property must be nullable, ie: #[Persistent] public ?int $foo

application by dg removed legacy services names (BC break)
application by dg Presenter::handleInvalidLink() -> processInvalidLink() (BC break)
application by dg added type hints (BC break)
application by dg composer: increased dependencies versions
application by dg used attribute Deprecated
application by dg used PHP 8.4 features
application by dg requires PHP 8.4
application by dg opened 4.0-dev
application by dg added since to #[Deprecated] attributes
application by dg ParameterConverter: a link argument passed both by position and by name is an invalid link (BC break)

link('show', ['id' => 1, 2]) for actionShow(int $id) bound the positional 2 to
$id and silently dropped the named value, whatever the order of the two.
toParameters() now throws InvalidLinkException, which is reported according
to Presenter::$invalidLinkMode. Mixing the two kinds for different parameters
keeps working.

latte by dg Released version 3.1.10
latte by dg fixed phpstan
latte by dg docs: sandbox internals describe its other boundaries

c01493da-8e95-4462-be17-bff3d6fd35fd

latte by dg Engine: Latte version is part of the template class name

With autoRefresh off, templates compiled by the previous version stayed in
the cache after an upgrade, so a fix of the compiler (such as of the sandbox)
took effect only after the cache was cleared.

c01493da-8e95-4462-be17-bff3d6fd35fd

Last synchronization: 2026-11-23 14:02:55