Skip to content

streams: Various minor refactorings #19106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 4, 2025

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jul 12, 2025

Commits should be reviewed in order as they are meant to be independant.

@@ -35,9 +35,9 @@
/* {{{ resource and registration code */
/* Global wrapper hash, copied to FG(stream_wrappers) on registration of volatile wrapper */
static HashTable url_stream_wrappers_hash;
static int le_stream = FAILURE; /* true global */
Copy link
Member

Choose a reason for hiding this comment

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

Well, not checked by first party engine code, but sure

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 think this should just be removed then?

@@ -760,21 +750,21 @@ PHP_FUNCTION(stream_select)
FD_ZERO(&efds);

if (r_array != NULL) {
set_count = stream_array_to_fd_set(r_array, &rfds, &max_fd);
Copy link
Member

Choose a reason for hiding this comment

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

One could wonder why the ZPP doesn't use Z_PARAM_ARRAY_HT_EX2 in the first place

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 think because the parameter is a reference that is also written to, and so you need it to be a zval?

Copy link
Member

Choose a reason for hiding this comment

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

It is a ref that is written to, but that doesn't mean it needs to be a zval?

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 frankly never understand how PHP references are meant to work, and how to deal with them in functions.

Will try and see if I can just use Z_PARAM_ARRAY_HT_EX2 directly :)

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 really don't see how to handle the zval* being destroyed and reassigned to when using the HT directly, so I'll leave this for someone else to figure out.

Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

As far as pgsql/socket go, lgtm but I like php_stream_cast return type better in this anyway.

@Girgias Girgias force-pushed the streams-minor-refactorings branch from cce84e7 to 0db4f60 Compare August 3, 2025 17:00
@Girgias Girgias merged commit 4d5bdef into php:master Aug 4, 2025
8 of 9 checks passed
@Girgias Girgias deleted the streams-minor-refactorings branch August 4, 2025 14:31
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.

3 participants