- π¬π§United Kingdom joachim
I don't think patch #12 is right. We shouldn't be ignoring invalid keys -- if there is an invalid key, then the developer has made a mistake in the output of their render array, and they need to be told so they can fix it.
The first part of patch #2 looks nearly right. The second part doesn't seem relevant to me -- I don't know when that condition would fire, but it's out of scope for this issue.
One other tweak -- the isset() should be kept, otherwise we'll be adding new errors for NULL values. (And perhaps we *should* do that -- but again, that is out of scope).
Tagging as novice:
- update patch #2
- remove the 2nd chunk
- preserve the isset() condition
- make an MR - First commit to issue fork.
- Merge request !6937Issue #3083690 by gxleano: Update trigger error message β (Open) created by gxleano
- Status changed to Needs review
10 months ago 10:23am 6 March 2024 - Status changed to Needs work
10 months ago 10:28am 6 March 2024 - π¬π§United Kingdom joachim
Thanks for the MR. The @key needs to be preserved so the developer knows where the problem is.
- Status changed to Needs review
10 months ago 12:04pm 6 March 2024 - πͺπΈSpain gxleano CΓ‘ceres
Thanks @joachim to put an eye on it.
I've put back the
@key
and also updated the tests that go with it. - Status changed to RTBC
10 months ago 2:37pm 6 March 2024 - πΊπΈUnited States smustgrave
Ran the test-only feature and got
1) Drupal\Tests\Core\Render\ElementTest::testInvalidChildren Failed asserting that exception message '"foo" is an invalid render array key' contains '"foo" is an invalid render array key. Value should be an array but got a string'. /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121 /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55 /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651 /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/TextUI/Command.php:144 /builds/issue/drupal-3083690/vendor/phpunit/phpunit/src/TextUI/Command.php:97 FAILURES! Tests: 38, Assertions: 51, Failures: 1.
So change has coverage. Think this is a nice little improvement
- Status changed to Fixed
10 months ago 6:02pm 16 March 2024 - π¬π§United Kingdom alexpott πͺπΊπ
Committed and pushed ee4eaba6ff to 11.x and 85d08d1cfb to 10.3.x. Thanks!
Can we get a follow-up to convert the 3 core instances of
trigger_error(new FormattableMarkup(
totrigger_error(sprintf(
- we should not using FormattableMarkup here. -
alexpott β
committed 85d08d1c on 10.3.x
Issue #3083690 by gxleano, mparker17, jungle, joachim, Kris77: '"@key"...
-
alexpott β
committed 85d08d1c on 10.3.x
-
alexpott β
committed ee4eaba6 on 11.x
Issue #3083690 by gxleano, mparker17, jungle, joachim, Kris77: '"@key"...
-
alexpott β
committed ee4eaba6 on 11.x
- π¬π§United Kingdom joachim
Yup, I spotted that but it was out of scope to change that here.
There is #2552163: Do not use FormattableMarkup in exceptions, trigger_error, and debug (the second pass) β .
Automatically closed - issue fixed for 2 weeks with no activity.