Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ COPY src src
COPY template template
COPY demos demos
RUN echo "<?php header('Location: /demos/');" > index.php
RUN sed -E "s/(\\$minified = )true;/\\1false;/g" -i src/App.php
RUN sed -E "s/(\\\$minified = )true;/\\1false;/g" -i src/App.php

RUN php demos/_demo-data/create-db.php
RUN sed -E "s/\(('sqlite:.+)\);/(\$_ENV['DB_DSN'] ?? \\1, \$_ENV['DB_USER'] ?? null, \$_ENV['DB_PASSWORD'] ?? null);/g" -i demos/db.default.php
2 changes: 1 addition & 1 deletion src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ public function getTag(string $tag = null, array $attr = [], $value = null): str
if (is_array($v)) {
$result[] = $this->getTag(...$v);
} elseif (['script' => true, 'style' => true][$tag] ?? false) {
if ($tag === 'script') {
if ($tag === 'script' && $v !== '') {
$result[] = '\'use strict\'; ';
}
// see https://mathiasbynens.be/notes/etago
Expand Down
2 changes: 2 additions & 0 deletions tests/TagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public function testEtagoEscape(): void
static::assertTagRender('<script>\'use strict\'; foo <b>bar</b> <script>x = \'<style></style>\';"<\/script>" <style><\/script></script>', ['script', [], $v]);
static::assertTagRender('<style>foo <b>bar</b> <script>x = \'<style><\/style>\';"</script>" <style></script></style>', ['style', [], $v]);
static::assertTagRender('<b>foo &lt;b&gt;bar&lt;/b&gt; &lt;script&gt;x = &apos;&lt;style&gt;&lt;/style&gt;&apos;;&quot;&lt;/script&gt;&quot; &lt;style&gt;&lt;/script&gt;</b>', ['b', [], $v]);

static::assertTagRender('<script src="js&gt;"></script>', ['script', ['src' => 'js>'], '']);
}

public function testVoidTag(): void
Expand Down