Table of Contents

PHP RFC: Extension load priority

Introduction

This RFC involves introducing a priority to to the internal loading order of extensions. This is an Engine level feature and cannot be controlled in userland.

Why?

Extensions today are loaded in the order they appear in php.ini, this is fine for most of the extensions, however historically there have been some extensions which needed to have a different order in php.ini in order to be loaded, for this RFC I will base it on the exif extension dependency on mbstring.

Exif have until recently been attempted to be loaded before mbstring (because the extension= directive in php.ini are in alphabetic order), this means the dependency checking mechanism fails as mbstring simply is not loaded, despite its next in the list of extensions to be loaded. To overcome this in an easily (and elegant manner, which ofcourse is not only specific to this issue), a priority loading mechanism can be implemented directly into the zend_module_entry struct.

Implementation details

The patch (see below), will add/change the following items:

Note, the value of ZEND_EXTPRIO_SECOND that defaults to 3 is intended.

Note, values below 1 is not allowed and values above 9 can be used but since we don't really need a bigger namespace range, 9 will do for last loading for now. Other values between 1 and 9 thats not masked to a constant can be used manually for tweaks, should that be needed.

Implementation

An implementation patch is currently being worked upon.