Use zend.assertions PHP setting instead of assert.active

Created on 9 August 2023, over 1 year ago
Updated 1 November 2023, about 1 year ago

Problem/Motivation

Drupal uses the PHP setting assert.active to disable assert() evaluation in the .htaccess file:

php_value assert.active 0

However, PHP documentation says "zend.assertions should be used instead to control the behaviour of assert()" instead of assert.active.

assert.active has been deprecated in PHP 8.3.

Steps to reproduce

N/A

Proposed resolution

  1. Use the zend.assertions PHP setting instead.

    The doc states:

    When set to 1, assertion code will be generated and executed (development mode). When set to 0, assertion code will be generated but it will be skipped (not executed) at runtime. When set to -1, assertion code will not be generated, making the assertions zero-cost (production mode).

    What value should be used in zend.assertions? The wiki page Runtime Assertions β†’ already instructs to use -1 for production servers and 1 for development servers. It seems the safer value is -1 (no assertion code generated while code is being interpreted). However, this could impact sites relying in assert for tests or other checks.

    To do this, .htaccess file should be updated (in the root bolder and in core/assets/scaβ€Žffold/filesβ€Ž).

    NOTE: This issue comes from πŸ“Œ Add .user.ini Needs review . There a user.ini file is being added. Both issues should be in sync (if user.ini is added, here we should update user.ini as well; if this issue is committed that issue needs to be updated with the PHP settings usage).

  2. Update documentation

    The previously linked wiki page Runtime Assertions instructs to also use assert.active. It should be updated, removing or stating that setting is not required anymore.

Remaining tasks

Decide what value to use on zend.assertions.

Provide patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

TBD

✨ Feature request
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡ͺπŸ‡ΈSpain tunic Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024