Description
For security reasons and to comply with Content Security Policy (CSP), we are wrapping all our <script> tags using $this->Html->scriptStart(['block' => true]). However, CakePHP does not recognize the <script> tags inside and throws an error in the console. If we remove the tags, we lose syntax highlighting, which is important for development.
Example:
<?php $this->Html->scriptStart(['block' => true]) ?>
<script type="text/javascript">
initSocketIo(function(socket) {
})
</script>
<?php $this->Html->scriptEnd() ?>
Expected Behavior:
- CakePHP should recognize the
<script> tags inside $this->Html->scriptStart() without errors.
- Syntax highlighting should remain available in IDEs.
- On render, CakePHP should strip the
<script> tags from the block to ensure correct output while keeping syntax highlighting during development.
Actual Behavior:
- CakePHP does not recognize the script tags and throws an error in the browser console.
- Removing the <script> tags resolves the error but results in loss of syntax highlighting.
CakePHP Version
4.5
PHP Version
No response
Description
For security reasons and to comply with Content Security Policy (CSP), we are wrapping all our
<script>tags using$this->Html->scriptStart(['block' => true]). However, CakePHP does not recognize the<script>tags inside and throws an error in the console. If we remove the tags, we lose syntax highlighting, which is important for development.Example:
Expected Behavior:
<script>tags inside$this->Html->scriptStart()without errors.<script>tags from the block to ensure correct output while keeping syntax highlighting during development.Actual Behavior:
CakePHP Version
4.5
PHP Version
No response