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
29 changes: 23 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ jobs:
with:
php-version: '8.4'
extensions: mbstring, xml
tools: castor

- name: Setup Castor
uses: castor-php/setup-castor@v1

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction
Expand All @@ -40,7 +42,9 @@ jobs:
with:
php-version: '8.4'
extensions: mbstring, xml
tools: castor

- name: Setup Castor
uses: castor-php/setup-castor@v1

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction
Expand All @@ -61,21 +65,29 @@ jobs:
- "8.5"
symfony:
- '6.4.*'
- '7.3.*'
- '7.4.*'
- '8.0.*'
- '8.1.*'
minimum-stability: ['']
composer-flags: ['']
name: ['']
include:
- php-version: 8.2
composer-flags: '--prefer-lowest'
name: '(prefer lowest dependencies)'
- php-version: 8.5
symfony: '8.2.*'
minimum-stability: 'dev'
name: '(dev)'
exclude:
- php-version: "8.2"
symfony: '8.0.*'
- php-version: "8.3"
symfony: '8.0.*'
- php-version: "8.2"
symfony: '8.1.*'
- php-version: "8.3"
symfony: '8.1.*'
steps:
- name: Checkout
uses: actions/checkout@v6
Expand All @@ -89,10 +101,15 @@ jobs:
php-version: ${{ matrix.php-version }}
extensions: mbstring, xml
ini-values: phar.readonly="Off"
tools: castor

- name: Setup Castor
uses: castor-php/setup-castor@v1

- name: "Configure Symfony"
run: 'composer config extra.symfony.require "${{ matrix.symfony }}"'
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer config extra.symfony.require "${{ matrix.symfony }}"

- name: Get composer cache directory
id: composer-cache
Expand All @@ -106,7 +123,7 @@ jobs:
restore-keys: ${{ runner.os }}-composer-

- name: Allow dev dependencies
run: if [ "${{ matrix.minimum-stability }}" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
run: if [ "${{ matrix.minimum-stability }}" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev","prefer-stable":true}/' composer.json; fi;

- name: Install Composer dependencies
run: composer update --prefer-dist --no-interaction ${{ matrix.composer-flags }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
# Temporary
/tests/app/var
/tests/app/public/bundles
/tests/app/config/reference.php
/tests/app/config/schema.json
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('app/var')
->notPath('app/config/reference.php')
->append([
__FILE__,
])
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Added support for Symfony 8.2

## 1.11.1 (2026-05-26)

* Fixed deprecation notice from Symfony 8.1
Expand Down
17 changes: 15 additions & 2 deletions EventListener/ReplaceImageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,22 @@ public function onKernelResponse(ResponseEvent $event): void

$content = (string) $event->getResponse()->getContent();

$image = \sprintf('<img alt="Exception detected!" src="%s" data-gif style="height:100px" />', $url);

$content = preg_replace(
'@<div class="exception-illustration hidden-xs-down">(.*?)</div>@ims',
\sprintf('<div class="exception-illustration hidden-xs-down" style="opacity:1; height: 100px"><img alt="Exception detected!" src="%s" data-gif style="height:100px" /></div>', $url),
[
// Symfony < 8.2: ghost next to the exception message
'@<div class="exception-illustration hidden-xs-down">(.*?)</div>@ims',
// Symfony >= 8.2: ghost moved to the bottom of the page, remove it
'@<div aria-hidden="true" class="exc-ghost">(.*?)</div>@ims',
// Symfony >= 8.2: put the gif next to the exception message instead
'@<div class="exceptions-header">@i',
],
[
\sprintf('<div class="exception-illustration hidden-xs-down" style="opacity:1; height: 100px">%s</div>', $image),
'<div aria-hidden="true" class="exc-ghost"></div>',
\sprintf('<style>.exceptions-header{display:flex;align-items:center;gap:15px;padding-right:15px}.exceptions-header>:last-child{flex:1;min-width:0}.exceptions-header .exception-illustration{order:1;flex-shrink:0;padding:10px 0}.exceptions-header .exception-illustration img{display:block;height:80px;border-radius:var(--radius)}@media (max-width:575px){.exception-illustration{display:none}}</style><div class="exceptions-header"><div class="exception-illustration">%s</div>', $image),
],
$content
);

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

The GhostBuster of your exception page!

It displays a GIF instead of Symfony's ghost on exception page and it's compatible with Symfony versions from 5.4 to 8.0.
It displays a GIF instead of Symfony's ghost on exception page and it's compatible with Symfony versions from 5.4 to 8.2.
Here is what it looks like :

![Demo Symfony 4.4](Resources/doc/images/demo.gif)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"require-dev": {
"doctrine/annotations": "^2.0",
"friendsofphp/php-cs-fixer": "^3.17",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.1",
"spatie/image-optimizer": "^1.8",
"symfony/asset": "^6.4 || ^7.3 || ^8.0",
"symfony/browser-kit": "^6.4 || ^7.3 || ^8.0",
Expand All @@ -34,7 +34,7 @@
"symfony/dependency-injection": "^6.4 || ^7.3 || ^8.0",
"symfony/error-handler": "^6.4 || ^7.3 || ^8.0",
"symfony/http-kernel": "^6.4 || ^7.3 || ^8.0",
"symfony/monolog-bundle": "^3.8 || ^7.0",
"symfony/monolog-bundle": "^3.8 || ^4.0",
"symfony/phpunit-bridge": "^6.3 || ^7.0",
"symfony/stopwatch": "^6.4 || ^7.3 || ^8.0",
"symfony/web-profiler-bundle": "^6.4 || ^7.3 || ^8.0",
Expand Down
5 changes: 5 additions & 0 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ private function getImage(string $content): \DOMElement
$image = $xpath->query('//div[contains(@class, "exception-illustration")]/svg')->item(0);
}

if (!$image) {
// SF >= 8.2
$image = $xpath->query('//div[contains(@class, "exc-ghost")]/svg')->item(0);
}

$this->assertNotNull($image);

return $image;
Expand Down
Loading