Skip to content

2.1.6

Latest

Choose a tag to compare

@vrkansagara vrkansagara released this 29 Jul 12:50
359c226

Fixed

  • Middleware ran the whole request pipeline twice when the current environment didn't match target_environmentAfterMiddleware called $next($request) a second time instead of returning the response it already had, re-running controllers/views (and, for stateful packages like Livewire, component mount/hydration) a second time in one HTTP request. (#38)
  • Response bodies could crash or get corrupted for non-HTML content:
    • BinaryFileResponse/StreamedResponse (file downloads, Excel exports) throw on setContent() and return false from getContent() — now detected and passed through untouched. (#40)
    • Binary payloads served as a plain string body (e.g. barryvdh/laravel-dompdf's stream()) were corrupted by HTML whitespace/comment regexes running over raw bytes. Compression now only runs for Content-Type: text/html responses. (#35)
  • Debug toolbar output could go missingsetContent() doesn't touch Content-Length; a stale, larger value left over from before compression shrank the body could cause truncation right around trailing content like an injected toolbar. Content-Length is now removed after compression so the server recomputes it. (#37)
  • A literal --> inside <script> content (e.g. a debug toolbar dumping SQL or a stack trace) could be mistaken by the HTML comment regex for an earlier comment's closing marker, deleting real markup in between. <script> blocks are now isolated from the HTML comment/whitespace rules.
  • LaraOutPress::formatSizeUnits(0) returned the string "NAN" instead of a sane default; now returns "0B".
  • LaraOutPress::setEnabled() could assign a non-boolean value (e.g. a stray .env typo) to a bool-typed property, causing a TypeError. Now only a strict boolean true enables the module.
  • A .env value like VRKANSAGARA_COMPRESS_ENVIRONMENT="${APP_ENV}" is not expanded by dotenv and was silently read as the literal string ${APP_ENV}, so compression never activated. target_environment now falls back to the current app environment when empty or left with an unresolved ${...} placeholder.
  • Division-by-zero crash in debug mode when the response body was empty.
  • Undeclared $debug property triggered a PHP 8.2+ dynamic-property deprecation on every debug-mode request.
  • Dead/contradictory route-exclusion logic in isCurrentRouteAllowedToCompress simplified to the correct check.
  • A committed vendor/google/closure-compiler directory (7.3MB .jar included) was shipping in every git archive/Packagist zipball despite being gitignored; untracked it and added .gitattributes export-ignore rules.

Changed

  • Debug stats overlay moved from the top to the bottom of the page.
  • AfterMiddleware::handle() decoupled into focused, typed private methods (shouldCompress, applyPerformanceIniOverrides/restoreIniOverrides, compressBuffer, renderDebugBanner, isCompressibleContentType) with full docblocks; whitespace/comment/JS-minifier rule sets moved to private consts instead of being rebuilt on every request.
  • README rewritten: fixed a broken .env example that recommended the exact ${APP_ENV} pattern that silently breaks compression, added a config/env reference table, vendor:publish troubleshooting steps, and a note on which .env file Laravel actually loads.
  • PHP support narrowed to ^8.2 || ^8.3 || ^8.4.
  • laravel/framework dev-dependency constraint updated to ^12.61 and config.platform.php pinned to 8.2.0 so composer.lock can't resolve Symfony 8.x components requiring PHP 8.4+ under the PHP 8.2/8.3 CI matrix.

Testing

  • Added 26 new unit tests covering all of the above (28 total), including real reproductions of the BinaryFileResponse, DomPDF-binary, and Content-Length regressions verified to fail on pre-fix code and pass on the fix.