Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
This is a follow-up for #2973615: Add Section delta as extra data on filtered block definitions. $delta is passed as a string but should be passed as a integer.
i.e.
+++ b/core/modules/layout_builder/src/Controller/ChooseBlockController.php
@@ -63,8 +63,13 @@ public function build(SectionStorageInterface $section_storage, $delta, $region)
+ // Currently delta is passed as a string, so we'll explicitily convert it
+ // to a integer.
+ $delta = (int) $delta;
Comment | File | Size | Author |
---|---|---|---|
#8 | delta-integer.png | 234.58 KB | tbsiqueira |
#7 | delta-passed-as-integer-2984509-7.patch | 5.08 KB | Falco010 |
Comments
Comment #4
jdleonardNote that the patch in #3038981: Inline blocks missing section delta extra data on filtered block definitions adds an analogous cast in function inlineBlockList() of the same class.
Comment #5
tim.plunkettTagging
Comment #7
Falco010Just tested and debugged this, dynamic route parameters always are a string.
Even after trying to add the Regular Expression on the route parameter, still receive it as a string.
As @tim.plunkett mentioned earlier in:
https://www.drupal.org/project/drupal/issues/2973615
This would be the solution, but it does not work for PHP 5.
However, the official documentation is stating that we don't support PHP 5.x anymore:
https://www.drupal.org/docs/8/system-requirements/php-requirements
So attaching a patch for the integer casting in the parameters of the functions.
Comment #8
tbsiqueiraTested, it is working fine, the delta is now one integer.
Comment #9
tim.plunkettUnfortunately, this is a BC-breaking change in versions before PHP 7.2, which means it won't be allowed in Drupal 8.
https://3v4l.org/kRYDG
The good news is that Drupal 9 requires PHP 7.2, so this sort of change can safely be made!
See https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters
I'm not sure if there's a D8 safe fix available, or what the current policy is for D9 only fixes. But leaving this at RTBC for now.
Comment #11
catchCommitted 7acaffe and pushed to 9.0.x. Thanks!