com php-src: Revert SplFileInfo BC break while keeping fix for assertion removal: ext/spl/spl_directory.c ext/spl/tests/spl_file
info_getextension_leadingdot.phpt

From: Date: Mon, 13 Jul 2015 17:27:06 +0000
Subject: com php-src: Revert SplFileInfo BC break while keeping fix for assertion removal: ext/spl/spl_directory.c ext/spl/tests/spl_file
info_getextension_leadingdot.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87964@lists.php.net to get a copy of this message
Commit: 21686f1b3070bfb8a535ec717d9b69a094fe651a Author: Anthony Ferrara <ircmaxell@gmail.com> Mon, 13 Jul 2015 13:27:06 -0400 Parents: 4b78636f3f6c12c1ad0625d275bc0239ca4eb5b5 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=21686f1b3070bfb8a535ec717d9b69a094fe651a Log: Revert SplFileInfo BC break while keeping fix for assertion removal This reverts the minor bc-break where .test would return an empty extension. This is different from 5.x's behavior. In 7, it would result in an assertion failure crash. The fix for the removal of this assertion is kept, keeping BC with 5.x. Changed paths: M ext/spl/spl_directory.c M ext/spl/tests/spl_fileinfo_getextension_leadingdot.phpt Diff: diff --git a/ext/spl/spl_directory..c b/ext/spl/spl_directory.c index 0ee1ae0..eaaf609 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -939,9 +939,7 @@ SPL_METHOD(SplFileInfo, getExtension) ret = php_basename(fname, flen, NULL, 0); p = zend_memrchr(ZSTR_VAL(ret), '.', ZSTR_LEN(ret)); - if (p && p > ZSTR_VAL(ret)) { - /* Check for the string length, incase the only '.' is the - * first character of the string */ + if (p) { idx = (int)(p - ZSTR_VAL(ret)); RETVAL_STRINGL(ZSTR_VAL(ret) + idx + 1, ZSTR_LEN(ret) - idx - 1); zend_string_release(ret); diff --git a/ext/spl/tests/spl_fileinfo_getextension_leadingdot.phpt b/ext/spl/tests/spl_fileinfo_getextension_leadingdot.phpt index 0ade304..7b2be18 100644 --- a/ext/spl/tests/spl_fileinfo_getextension_leadingdot.phpt +++ b/ext/spl/tests/spl_fileinfo_getextension_leadingdot.phpt @@ -10,4 +10,4 @@ var_dump($fileInfo->getExtension()); unlink($file); ?> --EXPECT-- -string(0) "" \ No newline at end of file +string(4) "test"

« previous php.cvs (#87964) next »