Skip to content

ext/opcache: minor refactoring (2026-03)#21397

Open
Girgias wants to merge 7 commits intophp:masterfrom
Girgias:opcache-minor-refactoring-2026-03
Open

ext/opcache: minor refactoring (2026-03)#21397
Girgias wants to merge 7 commits intophp:masterfrom
Girgias:opcache-minor-refactoring-2026-03

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Mar 9, 2026

Commits should be reviewed in order.

@Girgias Girgias marked this pull request as ready for review March 9, 2026 19:15
@Girgias Girgias requested a review from dstogov as a code owner March 9, 2026 19:15
@Girgias Girgias requested a review from arnaud-lb March 9, 2026 19:15
Copy link
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

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

Looks good to me apart from Tim's comment

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Looks ok to me, apart from the comment made by Tim.

for (i = 0; i < entry->dependencies_count; i++) {
zend_class_entry *ce = zend_lookup_class_ex(entry->dependencies[i].name, NULL, 0);
for (uint32_t i = 0; i < entry->dependencies_count; i++) {
const zend_class_entry *dependent_ce = zend_lookup_class_ex(entry->dependencies[i].name, NULL, 0);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Technically the name dependent_ce indicates a dependency of dependent_ce on ce, rather than the other way around.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you have an idea for a better name? dependency_of_ce maybe?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, or just dependency_ce.

Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

I don't care about this.
If @iluuu1994 approves this, I don't object.

@Girgias Girgias force-pushed the opcache-minor-refactoring-2026-03 branch from ae63da1 to 964b903 Compare March 21, 2026 12:08
@Girgias Girgias requested review from TimWolla and iluuu1994 March 21, 2026 17:05
Copy link
Member

Choose a reason for hiding this comment

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

Should be?

Suggested change
zend_result ret;

Copy link
Member

Choose a reason for hiding this comment

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

And scope can also massively be reduced.

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's not really reducing scope, just merging declaration and assignment tho.

if (found && entry->dependencies) {
for (i = 0; i < entry->dependencies_count; i++) {
zend_class_entry *ce = zend_lookup_class_ex(entry->dependencies[i].name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
const zend_class_entry *dependent_ce = zend_lookup_class_ex(entry->dependencies[i].name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
Copy link
Member

Choose a reason for hiding this comment

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

Forgot to rename?

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 see the rename locally :| Might have pushed incorrectly.

Copy link
Member

Choose a reason for hiding this comment

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

There are two cases. This one is still wrong.

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

Not really my area of expertise, but didn't notice any obvious errors that were not already pointed out. Soft-LGTM.

@Girgias Girgias force-pushed the opcache-minor-refactoring-2026-03 branch from 964b903 to e75a912 Compare March 23, 2026 10:47
@Girgias Girgias force-pushed the opcache-minor-refactoring-2026-03 branch from e75a912 to e8cb781 Compare March 23, 2026 10:49
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.

5 participants