Skip to content

Assertion failure in main/streams/streams.c #15908

Closed

Description

@YuanchengJiang

Description

The following code:

<?php
class TestStream { //data, empty data, empty data + eof
    public $context;
    private $s = 0;
    function stream_open($path, $mode, $options, &$opened_path) {
            return true;
    }
    function stream_read($count) {
        echo "Read done\n";
        if ($this->s++ == 0)
            return "a\nbb\ncc";
        return "";
    }
    function stream_eof() {
        return $this->s >= 2;
    }
}
stream_wrapper_register("test", "TestStream");
$f = fopen("test://", "r");
file_put_contents(1, $f, 1, $f);
?>

Resulted in this output:

/php-src/main/streams/streams.c:2214: _php_stream_open_wrapper_ex: Assertion `resolved_path == ((void *)0)' failed.
Aborted (core dumped)

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Activity

  1. cmb69 commented on Sep 16, 2024

    @cmb69
    Member

    This happens to me only if a file "1" is in the include path.

    Anyhow, see #15027. I think this assertion is too presumptious. @nielsdos, what do you think?

    (By the way, I'm pretty surprised that include_path uses OnUpdateStringUnempty; that means you can have an empty path, although that is handled in php_resolve_path(); or is this just on Windows?)

  2. changed the title [-]Core dumped in main/streams/streams.c[/-] [+]Assertion failure in main/streams/streams.c[/+] on Sep 16, 2024
  3. self-assigned this
    on Sep 16, 2024
  4. added a commit that references this issue on Sep 16, 2024
    e757ef0
  5. added 2 commits that reference this issue on Sep 22, 2024
    018c0b3
    94c2ae6
  6. added a commit that references this issue on Sep 22, 2024
    5bfd45c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions