From 461d9e34f597437779c5a8d839d3887233026782 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:10:21 +0100 Subject: [PATCH 01/10] Update CI workflow by removing OS exclusions Fix failure on the CI. --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75ed398..62f9ee1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,13 +58,10 @@ jobs: exclude: - php-version: "8.1" symfony: '8.0.*' - operating-system: "ubuntu-latest" - php-version: "8.2" symfony: '8.0.*' - operating-system: "ubuntu-latest" - php-version: "8.3" symfony: '8.0.*' - operating-system: "ubuntu-latest" steps: - name: Checkout uses: actions/checkout@v3 From aab3e86607c20c960fdcdb2de3696fcfbf64fadc Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:13:27 +0100 Subject: [PATCH 02/10] Fix conditional check for exception type --- EventListener/ReplaceImageListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventListener/ReplaceImageListener.php b/EventListener/ReplaceImageListener.php index 8c476d3..538758b 100644 --- a/EventListener/ReplaceImageListener.php +++ b/EventListener/ReplaceImageListener.php @@ -37,7 +37,7 @@ public function onKernelResponse(ResponseEvent $event): void } $exception = $event->getRequest()->attributes->get('exception'); - if (!($exception instanceof \Throwable)) { + if (!$exception instanceof \Throwable) { return; } From 9783b7ea758245d36463e015de95a48475344301 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:14:06 +0100 Subject: [PATCH 03/10] Change function to static function in routing.php --- tests/app/config/routing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/config/routing.php b/tests/app/config/routing.php index a6ad786..c34bb89 100644 --- a/tests/app/config/routing.php +++ b/tests/app/config/routing.php @@ -11,7 +11,7 @@ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -return function (RoutingConfigurator $routes): void { +return static function (RoutingConfigurator $routes): void { $routes->add('test_routing_error', '/error-{status}') ->requirements(['status' => '\d+']) ->defaults(['_controller' => 'Joli\GifExceptionBundle\Tests\app\src\TestController::errorAction']) From f90e1e952d4e6cdcadb4896a8d1130ee42413904 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:16:40 +0100 Subject: [PATCH 04/10] Improve error message and format resize width --- Command/GifOptimizerCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Command/GifOptimizerCommand.php b/Command/GifOptimizerCommand.php index cc958e3..ea19d72 100644 --- a/Command/GifOptimizerCommand.php +++ b/Command/GifOptimizerCommand.php @@ -68,7 +68,7 @@ protected function initialize(InputInterface $input, OutputInterface $output): v new Gifsicle([ '-b', $optimizationLevel, - '--resize-width=' . $width, + sprintf('--resize-width=%s', (string) $width), ]), ]) ; @@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $imageDir = $input->getArgument('image_dir'); if (!\is_string($imageDir) || !is_dir($imageDir)) { - throw new \RuntimeException($imageDir . ' is not a valid directory'); + throw new \RuntimeException('image_dir is not a valid directory'); } $pattern = $imageDir . '/*/*.gif'; From 4731c9f42e131fc3ae7bf22412312d18cb05fdd4 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:19:24 +0100 Subject: [PATCH 05/10] Upgrade actions/cache from v2 to v4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62f9ee1..0adadd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ github.sha }} From a410f2732551a1c7ad9ddc27a430beed58471298 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:22:29 +0100 Subject: [PATCH 06/10] Validate resize width input before optimization Add validation for resize width input --- Command/GifOptimizerCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Command/GifOptimizerCommand.php b/Command/GifOptimizerCommand.php index ea19d72..6c73137 100644 --- a/Command/GifOptimizerCommand.php +++ b/Command/GifOptimizerCommand.php @@ -63,12 +63,16 @@ protected function initialize(InputInterface $input, OutputInterface $output): v $optimizationLevel = $input->getOption('optimization_level'); $width = $input->getOption('resize_width'); + if (!\is_numeric($width)) { + throw new \Exception('Invalid width.'); + } + $this->optimizer = OptimizerChainFactory::create() ->setOptimizers([ new Gifsicle([ '-b', $optimizationLevel, - sprintf('--resize-width=%s', (string) $width), + \sprintf('--resize-width=%s', (string) $width), ]), ]) ; From 2791cfaeb1f7d393c8a0fea9853027acd53c0770 Mon Sep 17 00:00:00 2001 From: Damien Alexandre Date: Tue, 3 Feb 2026 13:24:59 +0100 Subject: [PATCH 07/10] Fix is_numeric call in GifOptimizerCommand --- Command/GifOptimizerCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Command/GifOptimizerCommand.php b/Command/GifOptimizerCommand.php index 6c73137..e0e244d 100644 --- a/Command/GifOptimizerCommand.php +++ b/Command/GifOptimizerCommand.php @@ -63,7 +63,7 @@ protected function initialize(InputInterface $input, OutputInterface $output): v $optimizationLevel = $input->getOption('optimization_level'); $width = $input->getOption('resize_width'); - if (!\is_numeric($width)) { + if (!is_numeric($width)) { throw new \Exception('Invalid width.'); } From ce5958319e848239c28bdba1cdf8e596c0bd12c6 Mon Sep 17 00:00:00 2001 From: Damien ALEXANDRE Date: Tue, 3 Feb 2026 13:30:38 +0100 Subject: [PATCH 08/10] fix optimizer bin --- bin/optimizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/optimizer.php b/bin/optimizer.php index 07b96a6..b6444da 100755 --- a/bin/optimizer.php +++ b/bin/optimizer.php @@ -21,8 +21,8 @@ throw new RuntimeException('Unable to load autoloader.'); } -$application = new Application('gifexception'); -$application->add(new GifOptimizerCommand()); +$application = new Application('gifexception');dump($application); +$application->addCommand(new GifOptimizerCommand()); $application ->setDefaultCommand('gifexception:optimize', true) ->run() From aacab85e18832ac65d1dee62a944b4edcefd2804 Mon Sep 17 00:00:00 2001 From: Damien ALEXANDRE Date: Tue, 3 Feb 2026 13:38:19 +0100 Subject: [PATCH 09/10] fix --- .../public/images/403/dog-cat-stairs.gif | Bin 806398 -> 806398 bytes Resources/public/images/403/gandalf.gif | Bin 551042 -> 551042 bytes .../public/images/403/goat-motorbike.gif | Bin 860780 -> 860780 bytes .../public/images/403/men-in-black-flash.gif | Bin 47720 -> 47720 bytes .../public/images/404/confused-travolta.gif | Bin 573645 -> 573645 bytes Resources/public/images/404/looping-bird.gif | Bin 182337 -> 182337 bytes .../public/images/404/missing-stapler.gif | Bin 1096516 -> 1096516 bytes .../public/images/404/nothing-to-see-here.gif | Bin 105469 -> 105469 bytes Resources/public/images/other/athletic.gif | Bin 1018459 -> 1018459 bytes Resources/public/images/other/bottle.gif | Bin 501576 -> 501576 bytes .../public/images/other/captain-america.gif | Bin 276586 -> 276586 bytes .../public/images/other/car-accident.gif | Bin 306024 -> 306024 bytes .../public/images/other/carousel-fail-o.gif | Bin 440389 -> 440389 bytes Resources/public/images/other/castle.gif | Bin 240700 -> 240700 bytes Resources/public/images/other/dunk.gif | Bin 605973 -> 605973 bytes Resources/public/images/other/facepalm.gif | Bin 300477 -> 300477 bytes Resources/public/images/other/garbage.gif | Bin 153082 -> 153082 bytes Resources/public/images/other/kangaroo.gif | Bin 815409 -> 815409 bytes Resources/public/images/other/nope.gif | Bin 298588 -> 298588 bytes Resources/public/images/other/panda.gif | Bin 496386 -> 496386 bytes Resources/public/images/other/pingou.gif | Bin 154367 -> 154367 bytes Resources/public/images/other/plane.gif | Bin 1018638 -> 1018638 bytes Resources/public/images/other/pool.gif | Bin 593037 -> 593037 bytes Resources/public/images/other/tupper.gif | Bin 295352 -> 295352 bytes 24 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Resources/public/images/403/dog-cat-stairs.gif b/Resources/public/images/403/dog-cat-stairs.gif index 32e38265f28b49602ee0533c9253bb816c6a1286..56c77cd06a3bf592cecc099c738a97641e40d46b 100644 GIT binary patch delta 81 zcmex2+wk9P!wtWggcvYDGcR*HFEb+$GXXJ(%>u-%K+Fcj>_E%`#GF9P1;pIjd6{`W GdI1250S>eP delta 81 zcmex2+wk9P!wtWggk~>Y)-!$TlsR*JqC<OKEe4`NGcR*HFEb+$GXXJ(%>u-%K+Fcj?Av*nIZ9Ij14IiU delta 89 zcmZp=sMvH-al>OKt?k8{iVO^z3=9XWjGZ(YmaLsSZP|k3ZH@vA9GV;)YuC02NN_Bj lv-JP}|INJ2?Yzv4K+FWhAT|pSvjQ<25VLRRW#%YN1ps+58!-R? diff --git a/Resources/public/images/403/goat-motorbike.gif b/Resources/public/images/403/goat-motorbike.gif index 0e712c19bc1564a015c989d6843dc4bf72b26f60..04d73c1eb6add6eb083766caedd039304cd4c082 100644 GIT binary patch delta 73 zcmaEJ#N^EplMO7)Yz$z~%*EW!#morAOh61`vj8zG5VHX>I}mdKF((jn0Wmia^K9p0 I=1r0Z07o(nrT_o{ delta 73 zcmaEJ#N^EplMO7)Y@IVxGN-jQb1}DbF*5=&6A**gEI`Z(#B4y!4#XTl%n8I?K+Fxq LJlnaLd6VP;|5XsN diff --git a/Resources/public/images/403/men-in-black-flash.gif b/Resources/public/images/403/men-in-black-flash.gif index 42ec1a23440a3906b737689d63f080d4a7733adb..64104c112ac79614ebef5572f60a3c4174db6b1f 100644 GIT binary patch delta 35 ncmaFyh3Ul?CLVWBHw(+ei3~vu-x)UY{9s~Z0E5k3%yHWR>DUV0 delta 35 tcmV+;0NnrR^aAMg0t`n$3_2Ubi2a5WoNc diff --git a/Resources/public/images/404/confused-travolta.gif b/Resources/public/images/404/confused-travolta.gif index bb97f6e98ea4166c7d849675e5e46d1d53d94cbb..cf1a80fb69a7978c0443a47855d3820f154b3310 100644 GIT binary patch delta 101 wcmX@xsC>3jdBYVZGX}CiGZ%9^7c(OeGXXJ(%>u-%K+Fcj?Ay7RIS%gy053jdBYVZvp>K8yn235fPq7Tf#Li2_gWk*5)2%%NmUYxiV}(v*-l=Hnu-Dv w5{d$fL7Ik9hL*|_hCyDI&0NgwT+EC>%mluEhYbS(w+#aVG{yh1 BD=+{6 delta 95 zcmV-l0HFWDkPE?(3$VokNM~7EXkt%5T3Se9US?}!XKrR_acyyIYIkaIZf{wWf^d6; zhJk^Zgno^Ne1(gCf}DeVu8McMlX|L*ccr43rlXj`qK?O=kb?~ahYbS(w+#aVG{yA( BD#-u< diff --git a/Resources/public/images/404/missing-stapler.gif b/Resources/public/images/404/missing-stapler.gif index 965247e133dfdce4e96bc5e6ac0ac256dad286e5..6c3dcfdf67db1f6f6c1a2c46316fefef7711102b 100644 GIT binary patch delta 82 zcmWm0yAeP@7=_W{dj8y{8~L^-(2k4(wx*4Jf-`eU&86l$B&Rs7%WBZ#e}^6eMogFy NSg^uK*dA*?-VX@Q5QqQ( delta 82 zcmWm0xe-whiixlMNYTCOa^4HTN=Z?`32xm<0fmO9`z2 delta 30 mcmeyno$c>-whiix%>Vv>n{3D!GueTWy}6fhdoLqn!7KpVu?(O9 diff --git a/Resources/public/images/other/athletic.gif b/Resources/public/images/other/athletic.gif index 5bbe883b70abbf8e1308a5fb3c129af506708adf..b9bffc3e299da6f410e76545fc6d8b3e9f20e576 100644 GIT binary patch delta 78 zcmcaT#qRbLyAABj%nS?+&0NgwT+EC>%mlxsVGWv*2w=1p^QQA(Ja}c>xfUrE@m{A(P#6ECC^t3UrPEACsAM zZvljp33YV=hm(JGW(|W73OT`x5uSi9n-W5k@^w`R3?YFhP|)p*lTUU&3qqKHivmU% z0}0|nlbCin0fn>DcJdASa0&Y! zlUShe0TGi)q460hMAZ;Et6JT9b?a9oE?#UH;UYx2a$d29lT)H)0UNWqqEZ0?LxT*Y hhYX|vhYX|whYX|xhYX|yhYX|zhYX|!w+y5QJOe-lo>u?> delta 439 zcmV;o0Z9JH&K}6l9t=lGMmRZPkpP_l_coCXVFt#xsVGXv*2w=1p@#AAd@R|c>w^ErE@m{Ad}s5ECC>s3UrPE50ja6 zZvlXl33YV=gOh)CW(@-n3OT`x5uSi9n-V~i@^w`R1R;SZP|)oQlTUU&3qY8FivmU% z0}0|llbCin0R^+tcJdARa0&Yk zlUShe0RfXqq460BL{$(ut6JT9b?a9oE?#UH;Q~ata$d25lT)H)0SmLaqEZ0?L4ypW hhYX|vhYX|whYX|xhYX|yhYX|zhYX|!w+y5QJOi+9n_2(> diff --git a/Resources/public/images/other/captain-america.gif b/Resources/public/images/other/captain-america.gif index 577c79851f7dca7e8b4f301489eaedc37a28245d..096319a9d8c971b195c801c9fb0ec54090705048 100644 GIT binary patch delta 52 zcmaF$LEzN~0UmcxHw(+ei436(-x)UY++*DQg;A1m5))T5FLOIDGb0c)0WtG-US^h9 FQvm824;=si delta 56 zcmaF$LEzN~0UmcxHw(+ei436(-!nGy++$?>{rBJh|Nl3CWRziS=3#EiJb3-bT~ delta 43 wcmaEHP3Xlnp$&D6JlAeKe|hh9-=4&CzxFqGF}8Oxf-n;hGjH!=WVyEz01~eiYybcN diff --git a/Resources/public/images/other/carousel-fail-o.gif b/Resources/public/images/other/carousel-fail-o.gif index 216768c4c4c5a02341a531c0cfce5c880cd3e4bb..f44ed2111eaf8854ca64bec987aba1fbeb18356c 100644 GIT binary patch delta 117 zcmX^5LF(uSsSSBdoKt6~oV>c~^v6Gw%bB!v_uT*UtI RF^J6q#H`!7nAxni0sy{uD31UD delta 180 zcmX^5LF(uSsSSBdoToqjIeB%})Y&PM%bB$5pM1W#=l-AIoQU@6aqTnr3dvYhbc6(_ zL~ObGGdwcI%A-(FMu>%(FRR&q(~%BgHDMQDz3i4HOV<_YYAf~Dl&xH|dgbA3_nusJ z^NefjN>y`>5L9zMv2tT{v29*SV_J!aXL$176;r#H>}6r*Rs7HG=Nc01>=@u`q-Vg) e$iTqRtiar^z|085Oh61`vj8#cb_HfO)vW+Xvqt^^ diff --git a/Resources/public/images/other/castle.gif b/Resources/public/images/other/castle.gif index e62aaa39c8152d727702783fb42d91a0251d8ad2..fafaf95e105e62f0cd3dbfa8511feb582dde70d3 100644 GIT binary patch delta 60 kcmdmUgKy6bz721f6d4GCW?trYUS>uhX4=ln%&fl>05{eMY5)KL delta 60 zcmV-C0K@;h*bcnd4zTP3A&_fYrLB~7RVl{3w?RrVrhIX~z@)9UnaIbqwzi7@|Nnyx S1BVR*0f!9(0=EqV123t%aU662 diff --git a/Resources/public/images/other/dunk.gif b/Resources/public/images/other/dunk.gif index 72d5ed1e8bc8a657b9da1ff00932c7bc56aa5285..0feb011b2656a7c1a6a56caa47888a17ebdfde8e 100644 GIT binary patch delta 50 zcmbRGPi5*q6&`m_Hw(+ei42Jh-y0iwT6q{-d6-&xm|J;RT6tJodDvQc*jsrxw(@Xt G+5-Tku?^S& delta 50 zcmbRGPi5*q6&`m_Hw(+ei42Jh-}@SQT6q{-d6-&xm|J;RT6tJodDvQc*jsrxw(@Xt G+5-TmQ4Qq) diff --git a/Resources/public/images/other/facepalm.gif b/Resources/public/images/other/facepalm.gif index f12ff0dff809e860e8b73131a1c1235eb2bbe58d..a329c7a63840205fd97a22953ef861a850c036a3 100644 GIT binary patch delta 34 mcmdnHT4?WTp$%P(%nS?+&Ap86y^J8t1jNkSdl^{_rT_rSl?s*s delta 34 mcmdnHT4?WTp$%P(%>V!YZ|-Gm?_~sGCLm_s-pj~hFa-b)Uk#H0 diff --git a/Resources/public/images/other/garbage.gif b/Resources/public/images/other/garbage.gif index a09c9f45197f26924b29d9bfc1e354666b1150a7..06eaabfd11947e12de544a6d5b717524905f07fd 100644 GIT binary patch delta 59 icmeyhn)BCc&J8b_R2YZ=&AiO*yv&T-d6}8s1_1ysGYC%r delta 59 zcmV-B0L1_Ls|ot639#t`B(2H2s<*2mG#RC_mW7pTF)1hs92gWJA|W0ZBN!o4dsP4b R|AP$!hYbS(w+#aV?Na(c7Eu5I diff --git a/Resources/public/images/other/kangaroo.gif b/Resources/public/images/other/kangaroo.gif index 4d39789674acbd138d1849dc1da4d7837811412d..6a09850ab76e3186dd8f28e91989a874afaf5cb6 100644 GIT binary patch delta 73 zcmdn^$Z+E$!wpQ#Tnuo~%){Ky!^{Z8Oh61`vj8zG5VHX>I}mdKF((jn0WtS>9%dfZ FJOCA(4D$d0 delta 73 zcmdn^$Z+E$!wpQ#T>lvu85o#Z7}(gGd6?UIm>GeX35Y>#79eH?Vm2UV2VxE&<^*Cc NAm-lA!_1?a2LM>`4hH}L diff --git a/Resources/public/images/other/nope.gif b/Resources/public/images/other/nope.gif index 232f475c18f251ffb0a6cbbf6c9935b7e4a5afeb..f4da365978c13c080ad4e29f5d5493e518b481fc 100644 GIT binary patch delta 61 mcmcaJN9fKRp$+euuhW&&d7?Yzt^{@nmSJqXtT delta 61 zcmcaJN9fKRp$+eup~8&B8KqBEv+6?+hDxUNT8|Ia`DWxI|bPCC3Klcv=-k*p=m{RHt|} d^D?*dGBW}(6A**gEI`Z(#BAGnnc2Vg0|5Ey7Ks1= delta 81 zcmZo#CfBq~j>p~8&B8KqBEv+6?=Ls!*jIc|N4XjS_D9cZ2 d=4Ec@Wo86oCLji}S%8=oh}pLDGP8f}2LLhc7jggq diff --git a/Resources/public/images/other/pingou.gif b/Resources/public/images/other/pingou.gif index 6e2ae0fb7bc3ca24739adfc43d5eef2eb5fdc5e2..a6fac1583ea091e5c502be0314c9a136916b1972 100644 GIT binary patch delta 56 hcmeyrmGl2r&J8(?iVTE6b1!3iFC*jjUPh*(NB|jU2=V{` delta 56 zcmV-80LTCTwF&>V39xJdA-uQuo2Bft&#l(!?;&u!m92)Wxx#daR;{(|mcHZv|Nn!H O0f&tN0k@3-0&-c@iXe3W diff --git a/Resources/public/images/other/plane.gif b/Resources/public/images/other/plane.gif index 34e14849636537de9d88f14ac5e5866c18f49b3b..94803a1eea0f209868354f96e3bf966580f99c7f 100644 GIT binary patch delta 82 zcmeC1X4f~(ZbK5&rFA(!>=Vj(+>;M2g?G!lx diff --git a/Resources/public/images/other/pool.gif b/Resources/public/images/other/pool.gif index 9913bceb344da7cdf96f5a8c7b5c24bfb9ee9406..c7c11636244b167d580f23a81fb4f98b67e2ac0c 100644 GIT binary patch delta 58 zcmeC3snR=BWkUngv CYz=n+ delta 58 zcmeC3snR=BWkUlK^Z)< Date: Tue, 3 Feb 2026 13:41:44 +0100 Subject: [PATCH 10/10] fix cs and tests --- .github/workflows/ci.yml | 3 +++ bin/optimizer.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0adadd5..3425e9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Install gifsicle + run: sudo apt-get update && sudo apt-get install -y gifsicle + - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: diff --git a/bin/optimizer.php b/bin/optimizer.php index b6444da..1773bf6 100755 --- a/bin/optimizer.php +++ b/bin/optimizer.php @@ -21,7 +21,7 @@ throw new RuntimeException('Unable to load autoloader.'); } -$application = new Application('gifexception');dump($application); +$application = new Application('gifexception'); $application->addCommand(new GifOptimizerCommand()); $application ->setDefaultCommand('gifexception:optimize', true)