acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

BLT-5231: Update assertion handling to remove use of deprecated class #4726

Open tomdearden opened 8 months ago

tomdearden commented 8 months ago

Is your feature request related to a problem? Please describe. When using the latest version of BLT with Drupal >10.1 I get the following deprecation notice when visiting install.php:

The \Drupal\Component\Assertion\Handle is deprecated in Drupal 10.1.0 and will be removed from Drupal 11.0.0. Instead, replace the calls to \Drupal\Component\Assertion\Handle::register() method with assert_options(ASSERT_EXCEPTION, TRUE).

This seems to break the install process as well, once the batch UI shows up - I think the notice maybe causes the AJAX call to fail?

Describe the solution you'd like I'd like to see the default assertion handling in settings/default.local.settings.php changed from:

Handle::register();

to

assert_options(ASSERT_EXCEPTION, TRUE);

and the associated use statement removed from the top of the file.

Describe alternatives you've considered I can manually edit the generated file every time I create a new D10 project.

Additional context See here for the Drupal change request - https://www.drupal.org/node/3105918

thegbomb commented 8 months ago

This may be a short-lived changed as assert_options is also deprecated from PHP8.3

https://www.drupal.org/node/3105918 is correct for the original change, but there is also this: https://www.drupal.org/node/3391611

10.1 has the requested change in its version of the example.settings.local.php https://git.drupalcode.org/project/drupal/-/blob/10.1.x/sites/example.settings.local.php?ref_type=heads

But if you look at the 10.2 & 11.x versions, reference to it has been removed entirely, which I suggest is a better way forward. https://git.drupalcode.org/project/drupal/-/blob/10.2.x/sites/example.settings.local.php?ref_type=heads https://git.drupalcode.org/project/drupal/-/blob/11.x/sites/example.settings.local.php?ref_type=heads