1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

5 Commits

Author SHA1 Message Date
Gina Peter Banyard
f4e2e91d4b core: Remove disable_classes INI setting
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#remove_disable_classes_ini_setting

This took longer to merge than expected but the initial motivation from 2 years ago still applied:

As described in the email to the PHP internals list [1] this feature is fundamentally broken and pointless.

Only internal classes can be disable which brings the following observation. On a minimal build of PHP, with only the mandatory extensions enabled, there are 148 classes/interfaces/traits defined. [2]

Other than the SPL ones (and even then), disabling any of these classes will cause issues within the engine.
Moreover, the SPL ones are not a security concern.

Therefore, any other class that can be disabled must come from an extension that can be disabled altogether. And "disabling" a class from an extension without disabling said extension will render it useless anyway.

If a hosting provided is concerned about an extension, then it should not enable it in the first place. Not break it ad hoc.

Considering the above, I cannot see how this functionality was ever useful.

This is in stark contrast to the disable_functions INI setting, which can be used to selectively remove functionality of an extension without breaking it overall.

What makes this setting particularly broken is that it does not unregister the class, it only overwrites the create CE handler to emit a warning and purge the properties and function hashtables. This leads to various use after free, segfaults, and broken expectations for the engine and extensions which define said classes. On top of that, it is possible to actually instantiate such a class (and even classes which actually disallow this like ext/imap) in userland, and pass it to function that are typed against said class without raising a TypeError. However, when trying to do anything with said object stuff is going to explode in countless ways.

[1] https://news-web.php.net/php.internals/120896
[2] https://gist.github.com/Girgias/63d55ba1e50b580412b004046daed02b
2025-08-25 21:16:55 +01:00
DanielEScherzer
618190127e Zend/tests: organize some tests with sub directories (8) (#17873)
Create new sub directories for tests related to backtraces and for tests
related to `$this` being reserved in different places and not being usable or
reassignable.

Work towards GH-15631
2025-02-22 19:10:59 +00:00
DanielEScherzer
bce1f4aeb1 Zend/tests: organize some tests with sub directories (3) (#16444)
First pass at moving `Zend/tests/bug*` tests to existing sub directories

Work towards GH-15631
2025-02-10 00:35:51 +00:00
DanielEScherzer
0b94cf65e4 GH-16067: prevent invalid abstract during compilation of methods (GH-16069)
For classes that are not declared `abstract`, produce a compiler error for any
`abstract` methods. For anonymous classes, since they cannot be made abstract,
the error message is slightly different.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-10-23 15:04:18 +02:00
DanielEScherzer
275f63e7fd Zend/tests: organize some tests with subdirectories (2) (#16423)
Move more low-hanging fruit, creating new directories for the tests for:

* comparisons
* dynamic calls
* error messages
* `error_reporting()`
* exceptions
* `foreach()`
* garbage collection
* group `use` statements
* heredoc and nowdoc
* `goto` jumps
* late static binding
* magic methods
* namespaces
* numeric literal separators
* objects
* `settype()`
* cleaning of temporary values
* `unset()`

Additionally, move some tests into the existing subdirectory for `list()`
tests.

Drive-by fixes of some test numbers in the names of the `goto` tests.

Work towards GH-15631
2024-10-14 12:14:42 +01:00