Repository navigation
Sync the e() helper override removal into wip/1.3 - #273
LukeTowers merged 1 commit into
Conversation
e() has been overridden in Storm since 2020 for a single reason: Laravel 5.6 changed the helper's $doubleEncode default from false to true, aligning it with htmlspecialchars()'s own default, and rather than pass false at the handful of call sites that were double-encoding as a result, the default was reverted globally. That shim has outlived its purpose, and the call sites it was hiding are better fixed directly.
Keeping it has three costs. The body is still Laravel 5.x's, so e() here does not resolve a DeferringDisplayableValue and does not unwrap a BackedEnum — e($someEnum) raises Object of class X could not be converted to string where Laravel returns the backing value, which makes ordinary Laravel-style plugin code fail on Winter for a non-obvious reason. The escaping default matches neither Laravel nor PHP. And it makes the test suite disagree with the application: the composer binary requires vendor/autoload.php before the configured bootstrap, so PHPUnit resolves Laravel's e() while the served application resolves this one, and no test can observe the behaviour being overridden.
Deleting it restores Laravel's implementation in both contexts. bootstrap/autoload.php's priority require stays — it is still load-bearing for trans() and collect().
Behaviour changes
e() now double-encodes by default, matching Laravel and htmlspecialchars(). e('Tom & Jerry') returns Tom & Jerry rather than Tom & Jerry.
e() on a backed enum returns its value instead of raising.
e() resolves a DeferringDisplayableValue.
e(null) is unchanged (empty string).
(cherry picked from commit 7b506f5)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Cherry-picks #267 from
developintowip/1.3.wintercms/winter#1558 is on the modules'
wip/1.3and depends on #267, butwip/1.3here still has thee()override.CodeEditor::prepareVars()no longer double-encodes ande()does not either, so a stored<script>loads in the code editor as<script>.