Skip to content

SplFileInfo empty getBasename with more than on slash after PHP 8.1.1 #11338

Closed
ThePHPF/thephp.foundation
#90

Description

@deniskulygin

Description

The following code:

<?php

$file = new \SplFileInfo('/dir/anotherdir/basedir//');
var_dump($file->getBasename());

https://3v4l.org/vAh4f#v8.1.0

Resulted in this output:

string(0) ""

But I expected this output instead:

string(7) "basedir"

Before PHP 8.1.1 you got basename even with 2 slashes.

PHP Version

8.1.1

Operating System

No response

Activity

  1. ndossche commented on May 29, 2023

    @ndossche
    Member

    I think it's coming up with the empty string because it thinks the file path is between the two slashes...
    I'll run a bisect.
    EDIT: first bad commit is 13e4ce3

  2. self-assigned this
    on May 29, 2023
  3. added 2 commits that reference this issue on May 29, 2023
    5f96a41
    bce5360
  4. added 2 commits that reference this issue on May 30, 2023
    0e7ad40
    1ed6868
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