Skip to content

Conversation

@bukka
Copy link
Member

@bukka bukka commented Dec 3, 2025

This happens because disable_functions are not explicitly disabled. The fix explicitly calls zend_disable_functions when config is applied.

The WST test for this available here: https://github.com/wstool/wst-php-apache2handler/blob/6573dd55449504e71971c939bf1cca79412197b3/spec/instances/php-admin-value-disable-functions.yaml

This happens because disable_functions are not explicitly disabled. The
fix explicitly calls zend_disable_functions when config is applied.
@ndossche
Copy link
Member

ndossche commented Dec 3, 2025

This looks a bit ugly. Why is this not done in the ini message handler instead?

@bukka
Copy link
Member Author

bukka commented Dec 3, 2025

What do you mean?

This is normally explicitly called in main after all functions are loaded in https://github.com/php/php-src/blob/php-8.3.28/main/main.c#L2266 . The problem with php_admin_value (here and in FPM) is that they are loaded after this so zend_disable_functions needs to be called explicitly. We can consider some refactoring for master but I think it should mirror FPM for bug fix.

@bukka
Copy link
Member Author

bukka commented Dec 3, 2025

@ndossche
Copy link
Member

ndossche commented Dec 3, 2025

Create a custom INI_MH function for disable_functions. Either move the call to zend_disable_functions to the message handler, or if that's not possible due to the message handler not being called always at the right time, then call zend_disable_functions conditionally in the message handler.

FPM logic is here: https://github.com/php/php-src/blob/php-8.3.28/sapi/fpm/fpm/fpm_php.c#L121-L124

This looks equally ugly.

We can consider some refactoring for master but I think it should mirror FPM for bug fix.

We are on master.

@bukka bukka changed the base branch from master to PHP-8.3 December 3, 2025 22:14
@bukka
Copy link
Member Author

bukka commented Dec 3, 2025

Create a custom INI_MH function for disable_functions. Either move the call to zend_disable_functions to the message handler, or if that's not possible due to the message handler not being called always at the right time, then call zend_disable_functions conditionally in the message handler.

But it's not really supposed to be called the first time (it won't do much harm but it will need to be called again when all extensions are loaded). What is in FPM and here is just non standard thing that is mostly not being used so a new INI_MH would be used really just for this edge case.

We are on master.

Sorry forgot to set base somehow. This is a bug fix targetting 8.3.

@bukka
Copy link
Member Author

bukka commented Dec 3, 2025

But it's not really supposed to be called the first time

Just to clarify I mean it's not supposed to be called in php.ini loading because not all functions will be load at that time so there would need to be logic to skip it at that point but just allow to set it later. I guess it can be done but seems more like refactoring as it would also require FPM changes so that should happen just in master IMO.

@ndossche
Copy link
Member

ndossche commented Dec 4, 2025

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants