[php-src] PR #24135: Zend: add new zend_object_init{_with_constructor}() API
| From: | Girgias | Date: | Mon, 05 Oct 2026 14:29:16 +0000 |
| Subject: | [php-src] PR #24135: Zend: add new zend_object_init{_with_constructor}() API | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39166@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24135
Author: Girgias
Commits should be reviewed individually.
The motivation is that creating an object shouldn't require providing a zval backing storage,
as often one only cares about the
zend_object*. The common case where we *do* have a
backing storage is within userland functions where return_value is passed, this is IMHO
suboptimal as it leaks an implementation detail that is usually hidden by the use of the
RETURN/RETVAL macros, moreover it can make determining what the return value of userland function
*is* confusing if return_value is initialized and a plain return statement
is used to return early.
The commits follow the rough idea:
- Minor preparatory refactorings
- Introduction of new API
- Partial migration to the new API
Obviously not all cases have been migrated, sometimes it makes more sense to use the existing
object_init_ex API, or moving to the new API is desirable but various other
refactorings need to be made at an extension level for it to make sense.
Some future refactoring I am thinking of doing with the new APIs are:
- reflection
- intl
- SPL