php / php/php-src

dl() breaks expectations regarding permanent or interned strings

Open
#9,196 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Dynamic Loading Category: Engine Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

Creating this ticket to keep track of some issues related to dl() and permanent / interned strings:

Extensions loaded during a dl() call will try to allocate persistent interned strings for class names, function names, ini entries, etc. Normally, this is not allowed during a request.

The default in-request implementation of zend_string_init_interned still allows it, but the opcache implementation will simply return a non-interned string.

Calling dl() breaks in RC_DEBUG builds: https://github.com/php/php-src/pull/8606

This also breaks internal enums. The test in this branch will crash in debug builds: https://github.com/php/php-src/compare/master...arnaud-lb:php-src:internal-enums-dl-crash?expand=1

PHP Version

PHP 8.0

Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with zend_string.c around zend_string_init_interned and ext/opcache/ZendAccelerator.c around the linked implementations. Reproduce the dl() behavior in an RC_DEBUG build, then inspect the internal-enums-dl-crash test branch and determine the expected handling for persistent and interned strings across extensions.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.