Problem/Motivation

In example.settings.local.php we recommend using \Drupal\Component\Assertion\Handle::register() for assertions.

Since we're working on deprecating/removing this method in #3054072: Deprecate \Drupal\Component\Assertion\Handle::register(), we should change this recommendation.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Drupal\Component\Assertion\Handle will be deprecated in a future release. For this reason, example.settings.local.php has been updated to change the default assertion handling from:

assert_options(ASSERT_ACTIVE, TRUE);
\Drupal\Component\Assertion\Handle::register();


to:

assert_options(ASSERT_ACTIVE, TRUE);
assert_options(ASSERT_EXCEPTION, TRUE);

Site owners using settings.local.php for development sites may wish to update their workflow with this change.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Spokje created an issue. See original summary.

Spokje’s picture

catch’s picture

Status: Active » Reviewed & tested by the community

Looks great. The rest of that issue is tricky, but this feels like something to get in as soon as possible to minimise the number of installs using the class.

Spokje’s picture

Assigned: Spokje » Unassigned

xjm credited Berdir.

xjm credited BR0kEN.

xjm credited longwave.

xjm credited neclimdul.

xjm credited voleger.

xjm’s picture

I'm surprised the docblock above this doesn't need an update. I checked what it says:

/**                                                                             
 * Assertions.                                                                  
 *                                                                              
 * The Drupal project primarily uses runtime assertions to enforce the          
 * expectations of the API by failing when incorrect calls are made by code     
 * under development.                                                           
 *                                                                              
 * @see http://php.net/assert                                                   
 * @see https://www.drupal.org/node/2492225                                     
 *                                                                              
 * If you are using PHP 7.0 it is strongly recommended that you set             
 * zend.assertions=1 in the PHP.ini file (It cannot be changed from .htaccess   
 * or runtime) on development machines and to 0 in production.                  
 *                                                                              
 * @see https://wiki.php.net/rfc/expectations                                   
 */

Some of that is out of date, but not in a way that pertains to the code.

Adding some credits from the other issue.

  • xjm committed fa594a9 on 10.1.x
    Issue #3295650 by Spokje, BR0kEN, Berdir, catch, Krzysztof Domański,...

  • xjm committed 57d03b6 on 10.0.x
    Issue #3295650 by Spokje, BR0kEN, Berdir, catch, Krzysztof Domański,...
xjm’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +10.0.0 release notes, +9.5.0 release notes, +Needs release note

Committed to 10.1.x and cherry-picked to 10.0.x and 9.5.x.

I wasn't sure about backporting this to 9.4.x. Since it changes default patterns for site-owner managed files (in this case, local.settings.php we have to explain the addition/change in a release note). The backport wouldn't affect existing sites -- only new or reinstalled ones that copy over the new example.settings.local.php -- so in that sense it's non-disruptive.

I think it's probably okay to backport; we would just need the release note a little sooner then (and to adjust the issue tags accordingly).

Leaving at PTBP to discuss one way or another and to add the release note (which is needed either way).

longwave’s picture

Version: 9.4.x-dev » 9.5.x-dev
Status: Patch (to be ported) » Reviewed & tested by the community

Seems this didn't make it to 9.5.x.

I am not sure this is worth the backport to 9.4.x, it's hardly critical and we don't usually make these kinds of changes in patch releases.

  • xjm committed 646345c on 9.5.x
    Issue #3295650 by Spokje, BR0kEN, Berdir, catch, Krzysztof Domański,...
xjm’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs release note

Must've had a failed push.

Added a release note.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

catch’s picture

Issue summary: View changes