#59622 closed defect (bug) (fixed)
Block supports: Avoid warning for non string class attributes
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | 6.4 |
| Component: | Editor | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Focuses: | Cc: |
Description
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
Change History (20)
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 years ago
#1
- Keywords has-unit-tests added
@hellofromTonya commented on PR #5486:
2 years ago
#2
@dmsnell 10 Test_Block_Supports_Layout tests are failing from this change. Can you take a look please?
#3
@
2 years ago
- Milestone changed from Awaiting Review to 6.4
Pulling into the 6.4 milestone for awareness.
Would like to see this resolved to ship 6.4 without these errors. If it can be resolved before 6.4 RC1 tomorrow, then it could be considered for commit. However, currently the Test_Block_Supports_Layout automated tests are failing, which needs to be resolved.
This ticket was mentioned in Slack in #core by nicolefurlan. View the logs.
2 years ago
@peterwilsoncc commented on PR #5486:
2 years ago
#5
Could the tests be failing because the markup is missing a closing div? <div><div class="wp-block-group"></div>
To an extent I'm asking the silly question because I'd sure feel silly if I didn't and it turned out to be the case ;)
2 years ago
#6
@peterwilsoncc no, and I wasn't sure what happened. I tried a few things that I thought should fix it, so I'm curious when my change is at fault or if the implicit behavior this removed is at fault, even though from the unit tests it looks like it should be fine.
#7
@
2 years ago
- Milestone changed from 6.4 to 6.5
The RC1 release party is about to start. Ran out of time to get this into the release. Moving to 6.5.
#8
@
21 months ago
- Milestone changed from 6.5 to Future Release
Moving out of the milestone as there hasn't been any traction at all and 6.5 Beta is approaching.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#9
Trac ticket: Core-59622
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#10
Trac ticket: Core-59622
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
2 months ago
#11
I have removed the added tests since I had trouble figuring out what the function _should_ be doing, and since it seemed like they didn’t add much value anyway. The existing tests verify the passing behaviors and will catch regressions. This patch only adds a bit of safety to handle some edge cases and therefore need not be distracted by asserting that those edge cases fail.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#12
Trac ticket: Core-59622
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#13
Trac ticket: Core-59622
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#14
Trac ticket: Core-59622
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#15
Trac ticket: Core-59622
Gutenberg backport: WordPress/gutenberg#71594
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#16
Trac ticket: Core-59622
Gutenberg backport: WordPress/gutenberg#71594
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
#17
@
2 months ago
- Owner set to dmsnell
- Resolution set to fixed
- Status changed from new to closed
In 60727:
This ticket was mentioned in PR #5486 on WordPress/wordpress-develop by @dmsnell.
2 months ago
#18
Trac ticket: Core-59622
Gutenberg backport: WordPress/gutenberg#71594
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the get_attribute()
method in the HTML API returns true and null, respectively. If these returned
values are sent directly into string comparison functions then as of PHP 8.0 they
will throw E_DEPRECATED errors.
In this patch, block supports is enhanced to check that the class value is a
string before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the style attribute is
boolean. It will erroneously inject a ; at the beginning of the wrapper's new style
value. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.
Trac ticket: Core-59622
Block Supports: Avoid throwing warning when checking for class attribute as string.
When encountering HTML tags with boolean or missing tags, the
get_attribute()method in the HTML API returns
trueandnull, respectively. If these returnedvalues are sent directly into string comparison functions then as of PHP 8.0 they
will throw
E_DEPRECATEDerrors.In this patch, block supports is enhanced to check that the
classvalue is astring before it performs string operations on it.
---
There is a small likelihood of any real damage in production here, as these are only deprecation notices and the logic in these cases isn't affected by the change. That is,
the intention of the code is maintained even when the attribute values aren't strings.
For background support there's a tiny but benign defect when the
styleattribute isboolean. It will erroneously inject a
;at the beginning of the wrapper's newstylevalue. As this doesn't impact the rendering of the wrapper, it's not a true defect.
Further review belongs to block rendering code, but this will occur in the Gutenberg
repo since that PHP comes back into Core through the generated packages.
## Testing
There should be no functional or visual changes in this patch. Please consult blocks with layout and background support to verify that this hasn't adversely affected existing rendering. Verify that the test suite continues to pass.