Fix GH-16390: dba_open() can segfault for "pathless" streams #16498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dba_open()
accepts arbitrary stream wrapper paths, but unless no locking (-
) is specified, we try to determine the underlying file path. If that fails, we need to error out.Note that this had partially be resolved via 421c56d (i.e. as of PHP 8.3.0), but the
ZEND_ASSERT(opened_path)
is not correct; we cannot assert that all streams have a path, but need to catch that at runtime.Patch for PHP 8.3 and up
Also note that contrary to my former suggestion, I now went with a warning, because this is more inline with the other error handling, and simplifies resource management.