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 #2463967: Add .user.ini. 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

Comments

tunic created an issue. See original summary.

tunic’s picture

Related issues: +#2463967: Add .user.ini
andypost’s picture

For PHP 8.3 compatibility there's #3375693: Fix deprecated assert_options() function usage for PHP 8.3

Probably we can close it as duplicate

tunic’s picture

Status: Active » Closed (duplicate)

:(

I looked by assert.active and zend.assertions on the issue queue with no luck so I thought there was no issue already created.

tunic’s picture

Status: Closed (duplicate) » Active

I'm reopening this becase the issue it was a duplicate (#3375693: Fix deprecated assert_options() function usage for PHP 8.3) finally didn't address the problem stated in this issue.

Either we should edit .htaccess and use zend.assertions instead of assert.active or remove assert.active completely if the related issue made this settings duplicated, not useful or redundant (I am not sure becasue I don't full understand the related issue but it is sure it didn't touch .htaccess si the deprecated directive is still there).

tunic’s picture

Issue summary: View changes
tunic’s picture

Ok, this is a moving target!

The issue addressing this is this one: #3398033: Fix deprecated assert.active directive.

Back to duplicate.

tunic’s picture

Status: Active » Closed (duplicate)
tunic’s picture