New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Form] Removing self-closing slash from <input>
#47715
Conversation
<input>
<input>
I suggested the same for Symfony's templates, see symfony/symfony#47715
…ThomasLandauer) This PR was merged into the 6.2 branch. Discussion ---------- [Security] Removing self-closing slash from `<input>`s I suggested the same for Symfony's templates, see symfony/symfony#47715 Commits ------- c08a0a8 Removing self-closing slash from `<input>`s
Hi @ThomasLandauer, did you see, there are failed a lot of related tests. And there is a space before the |
@ThomasLandauer Do you have time to fix the tests? |
I'm not sure. The tests are based on // Wrap in <root> node so we can load HTML with multiple tags at
// the top level
$dom->loadXML('<root>'.$html.'</root>'); So if I should do it, I'd need somebody to take me by the hand... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests fixed.
I also removed all />
from the profiler and error pages.
@@ -72,6 +72,9 @@ protected function assertXpathNodeValue(\DOMElement $element, $expression, $node | |||
protected function assertMatchesXpath($html, $expression, $count = 1) | |||
{ | |||
$dom = new \DOMDocument('UTF-8'); | |||
|
|||
$html = preg_replace('/(<input [^>]+)(?<!\/)>/', '$1/>', $html); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the change that helps get tests green.
<input>
<input>
<input>
<input>
Thank you @ThomasLandauer. |
…#47715 (mpdude) This PR was merged into the 6.4 branch. Discussion ---------- [Form] Use self-closing `<input />` syntax again, reverting #47715 | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53649 | License | MIT This PR reverts #47715 and puts the trailing slash back into `<input .../>` markup in the form themes. The reasons are outlined in detail in #53649. Basically, the trailing slash in void elements like `<input>` is not required in HTML 5, yet it is perfectly valid and compliant with specs. Writing markup that way is required to parse and process it with an XML parser, like `libxml2` underlying all of the PHP DOM, XML etc. extensions. HTML 5 capable parser support has been added to PHP in php/php-src#12111 and will be available with PHP 8.4. So, we might want to remove the trailing slashes once Symfony requires at least PHP 8.4. Commits ------- 8c92200 Revert #47715
* 6.4: (21 commits) [ErrorHandler] Add missing self-closing tags on link elements Fix merge (bis) Fix merge Add missing return type [FrameworkBundle] ConfigBuilderCacheWarmer should be non-optional [HttpClient] Fix pausing responses before they start when using curl [Notifier] Updated the NTFY notifier to run without a user parameter [Translation] Fix constant domain resolution in PhpAstExtractor separate child and parent context in NotificationEmail on writes [Mailer] [Mailgun] Fix sender header encoding do not overwrite the cache key when it is false [Mailer] [Scaleway] Fix attachment handling [Mailer] Throw TransportException when unable to read from socket [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts Revert #47715 [HttpClient] Fix error chunk creation in passthru Adjusting and removing the 'review' attribute from the pt_br translation XML. [DependencyInjection] Fix loading all env vars from secrets when only a subset is needed Fix option filenameMaxLength to the File constraint (Image) [Serializer] Take unnamed variadic parameters into account when denormalizing ...
* 7.0: (21 commits) [ErrorHandler] Add missing self-closing tags on link elements Fix merge (bis) Fix merge Add missing return type [FrameworkBundle] ConfigBuilderCacheWarmer should be non-optional [HttpClient] Fix pausing responses before they start when using curl [Notifier] Updated the NTFY notifier to run without a user parameter [Translation] Fix constant domain resolution in PhpAstExtractor separate child and parent context in NotificationEmail on writes [Mailer] [Mailgun] Fix sender header encoding do not overwrite the cache key when it is false [Mailer] [Scaleway] Fix attachment handling [Mailer] Throw TransportException when unable to read from socket [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts Revert #47715 [HttpClient] Fix error chunk creation in passthru Adjusting and removing the 'review' attribute from the pt_br translation XML. [DependencyInjection] Fix loading all env vars from secrets when only a subset is needed Fix option filenameMaxLength to the File constraint (Image) [Serializer] Take unnamed variadic parameters into account when denormalizing ...
Switching form template from XHTML to HTML5 syntax.
https://validator.w3.org/nu/ says:
I haven't searched for other occurrences; waiting for some feedback first.