Skip to content

[WebProfilerBundle] Missing indent on non php files opended in the profiler #60835

@phcorp

Description

@phcorp

Symfony version(s) affected

4.0+

Description

When opening a non php file in the profiler the indent is missing.

This was introduced by this commit: symfony/twig-bridge@d8fc719 (PR: #26230)

How to reproduce

Considering any project running at https://127.0.0.1:8000

Non php file: https://127.0.0.1:8000/_profiler/open?file=config/packages/framework.yaml&line=0
PHP file: https://127.0.0.1:8000/_profiler/open?file=src/Kernel.php&line=0

Possible Solution

Removing the ending trim in Symfony\Bundle\WebProfilerBundle\Profiler::fixCodeMarkup() seems to fix the problem.

Processing can be differentiated according to whether the file is a PHP highlighted file or another type of file (see: https://www.php.net/manual/en/function.highlight-file.php).

A potential improvement would be to no longer highlight the file on the backend, but to transfer this responsibility to a javascript library (ex: https://highlightjs.org/).

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy