feat: Divi save pipeline – tree_rev lock, kses-safe save, revision, flags, cache, ToolResult
DiviSaver/DiviWriter/DiviComposition/DiviChange, WpValueSanitizer (S4), WpMediaResolver, DiviFlags (S11), DynamicContentMap from Divi's live registry (S22), S31 wiring, S35 control strip at apply() entry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -469,4 +469,46 @@ final class AttrWriterTest extends TestCase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ruling S35: controls go once at the entry of apply(), before placeholder resolution – a
|
||||
* control-split placeholder is the placeholder (resolved and checked), never literal text
|
||||
* that slipped past the placeholder check. Also deep inside values.
|
||||
*/
|
||||
public function testControlCharactersGoBeforePlaceholderResolution(): void
|
||||
{
|
||||
$writer = ComposeFixture::attrWriter();
|
||||
$reference = '$variable({"type":"content","value":{"name":"post_title","settings":{"before":"","after":""}}})$';
|
||||
|
||||
foreach ([chr(0), chr(1), chr(11), chr(127)] as $control) {
|
||||
$result = $writer->apply(
|
||||
'divi/heading',
|
||||
[],
|
||||
['title.innerContent' => ['desktop' => '{' . $control . '{post:title}}']],
|
||||
'attrs'
|
||||
);
|
||||
self::assertSame([], $result['errors'], (string) ord($control));
|
||||
self::assertSame($reference, $result['attrs']['title']['innerContent']['desktop']['value']);
|
||||
|
||||
// Embedded: refused like "{{post:title}}" inside text.
|
||||
$embedded = $writer->apply(
|
||||
'divi/heading',
|
||||
[],
|
||||
['title.innerContent' => ['desktop' => 'Hallo {' . $control . '{post:title}}']],
|
||||
'attrs'
|
||||
);
|
||||
self::assertStringContainsString('allein im Wert', $embedded['errors']['attrs.title.innerContent']);
|
||||
self::assertSame([], $embedded['attrs']);
|
||||
|
||||
$deep = $writer->apply(
|
||||
'divi/button',
|
||||
[],
|
||||
['button.innerContent' => ['desktop' => ['text' => "{{post:ti" . $control . "tle}}"]]],
|
||||
'attrs'
|
||||
);
|
||||
self::assertSame([], $deep['errors']);
|
||||
self::assertSame($reference, $deep['attrs']['button']['innerContent']['desktop']['value']['text']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user