Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Jan 5, 2026

Commits should be reviewed individually.

The primary motivation for me to introduce the newer FCC APIs was to make it easier to handle userland callables as the class autoloading system had a few bugs due to the complex semantics.

This is effectively taking the class autoloading part of #8294 as it is a straight-up code clarity improvement.

@Girgias Girgias requested a review from ndossche January 5, 2026 17:50
@Girgias Girgias marked this pull request as ready for review January 5, 2026 23:43
}

zend_hash_next_index_insert_ptr(spl_autoload_functions, alfi);
zend_fcall_info_cache *entry = emalloc(sizeof(zend_fcall_info_cache));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use zend_hash_next_index_insert_mem here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct, as I need to do a "deep" copy of the FCC by increasing refcounts rather than a shallow dup. Will add a comment to explain this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can if you use zend_fcc_addref instead of dup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, not sure why I didn't think of that.

Remove unused parameter
Use zend_string_concat2() API
Use size_t for ext_len parameter type
Return bool instead of int
@Girgias Girgias force-pushed the autoloader-fcc-api branch from 9304196 to cb596b2 Compare January 11, 2026 14:28
@Girgias Girgias requested a review from ndossche January 11, 2026 14:28
@Girgias Girgias force-pushed the autoloader-fcc-api branch from cb596b2 to 8ca47c8 Compare January 11, 2026 19:57
@Girgias
Copy link
Member Author

Girgias commented Jan 11, 2026

@ndossche done your suggestion and saw something else that I could clean up so pushed one extra commit. :)


if (fcc.function_handler && zend_string_equals_literal(
fcc.function_handler->common.function_name, "spl_autoload_call")) {
if (zend_string_equals_literal(fcc.function_handler->common.function_name, "spl_autoload_call")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to release the trampoline in this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be possible for this function name to be a trampoline. I guess adding an IS_INTERNAL check would guarantee that this is true.

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