Skip to content

Fix regression from GH-8587 #8615

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 2 commits into from
Jun 9, 2022
Merged

Conversation

iluuu1994
Copy link
Member

@iluuu1994 iluuu1994 commented May 23, 2022

Streams hold a reference to the stream wrapper. User stream wrappers
must not be released until the streams themselves are closed.

  • Does overriding stream_closer mean the stream has to be closed manually now? No
  • I'm not sure if user_wrapper_opendir is also closed through user_wrapper_close. I haven't figured out how to trigger that code path yet.

@nicolas-grekas FYI

@iluuu1994 iluuu1994 force-pushed the gh-8587-regression branch from 15202bd to d8cd754 Compare May 23, 2022 22:19
@iluuu1994 iluuu1994 marked this pull request as ready for review May 24, 2022 17:48
@iluuu1994
Copy link
Member Author

@cmb69 Do you know if php_stream_wrapper_ops.dir_opener can be tested or is this essentially dead code (or exclusively used for extensions)? I can only see it being used in _php_stream_opendir which is itself unused.

@cmb69
Copy link
Member

cmb69 commented May 24, 2022

I can only see it being used in _php_stream_opendir which is itself unused.

The stream function prefixed with underscore are usually not called directly, but rather the respective macros without that prefix. php_stream_opendir() is used several times in php-src, e.g. by DirectoryIterator::__construct().

@iluuu1994
Copy link
Member Author

@cmb69 Oh sorry, I totally missed that one usage was a macro. Sorry.

@cmb69
Copy link
Member

cmb69 commented May 25, 2022

np

The streams layer is in need of better documentation; there is https://github.com/php/php-src/blob/master/docs/streams.md, but that is incomplete and likely not really up to date, and should probably better be moved to phpinternalsbook.com.

@iluuu1994
Copy link
Member Author

Sorry for the delay. Should be good now. @nicolas-grekas Can you verify that this fixes your issue?

@nicolas-grekas
Copy link
Contributor

Works like a charm, thank you!

iluuu1994 added 2 commits June 9, 2022 12:12
Streams hold a reference to the stream wrapper. User stream wrappers
must not be released until the streams themselves are closed.
@iluuu1994 iluuu1994 force-pushed the gh-8587-regression branch from c85865e to b7c4342 Compare June 9, 2022 10:12
@nicolas-grekas
Copy link
Contributor

Is there anything pending on this PR? The issue keeps the Symfony CI red, I'm eager to see it fixed ;)

@iluuu1994 iluuu1994 merged commit c019421 into php:master Jun 9, 2022
@iluuu1994
Copy link
Member Author

I was just waiting for the build to be green 🙂

{
struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract;
zend_list_delete(uwrap->resource);
// FIXME: Unused?
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be kept?

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