Fix issue with SplFileInfo::getExtension() on files with only a leading '.' character
authorAnthony Ferrara <ircmaxell@gmail.com>
Mon, 13 Jul 2015 17:12:45 +0000 (13:12 -0400)
committerAnthony Ferrara <ircmaxell@gmail.com>
Mon, 13 Jul 2015 17:12:45 +0000 (13:12 -0400)
commit4b78636f3f6c12c1ad0625d275bc0239ca4eb5b5
tree22aed2c76b0ac08b1177a8e8ba7ab5bc0767b520
parente10e0a02aae42d9c3cd4fdf16357a9badfd36a71
Fix issue with SplFileInfo::getExtension() on files with only a leading '.' character

Currently, there is an assert() that fails on files like .gitignore crashing PHP. This patch fixes that.
Instead, now an empty string is returned (since the file has no extension). A test has been added to test this behavior.
ext/spl/spl_directory.c
ext/spl/tests/spl_fileinfo_getextension_leadingdot.phpt [new file with mode: 0644]