Deprecation: #110966 - PathUtility basename(), dirname(), pathinfo() 

See forge#110966

Description 

The following methods have been marked as deprecated and will be removed in TYPO3 v16.0:

  • \TYPO3\CMS\Core\Utility\PathUtility::basename()
  • \TYPO3\CMS\Core\Utility\PathUtility::dirname()
  • \TYPO3\CMS\Core\Utility\PathUtility::pathinfo()

They wrapped the native PHP functions to temporarily switch LC_CTYPE to the configured $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] . This option has been removed, see Breaking: #110966 - Remove UTF8filesystem and systemLocale settings, which also explains why the native functions handle UTF-8 paths correctly in every locale. The methods are now plain aliases of the native functions.

Impact 

Calling one of the methods triggers a PHP E_USER_DEPRECATED error.

Affected installations 

Installations with extensions that call one of the methods are affected. The extension scanner reports such usages as a strong match.

Migration 

Use the native PHP functions basename() , dirname() and pathinfo() instead. They take the same arguments and return the same results:

// Before
$fileName = PathUtility::basename($path);
$directory = PathUtility::dirname($path);
$extension = PathUtility::pathinfo($path, PATHINFO_EXTENSION);

// After
$fileName = basename($path);
$directory = dirname($path);
$extension = pathinfo($path, PATHINFO_EXTENSION);
Copied!