Skip to content

SplFileInfo::getFilename() segfault in combination with GlobIterator and no directory separator #12721

Closed
@gafnex

Description

@gafnex

Description

The following code:

<?php
$contents = '英文看不懂咋办?';
file_put_contents('file1.txt', $contents);
foreach (new GlobIterator('file1.txt') as $fileInfo) {
	echo $fileInfo->getFilename();
}

Resulted in this output:
segfault

But I expected this output instead:

file1.txt

PHP Version

PHP 8.2.12

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions