PHP-DS-001
DS
DS path constant
DS was a Joomla shortcut for the directory separator. It was removed in Joomla 4. PHP already has DIRECTORY_SEPARATOR. Forward slashes work on Windows in PHP.
DS → DIRECTORY_SEPARATOR or /
What you will see
- Undefined constant DS
- Use of undefined constant DS
Symptoms people search
helper path broken · failed to open stream after upgrade
Replace this code
Swap DS for DIRECTORY_SEPARATOR or /.
Joomla 3
Remove or stop calling this
$path = JPATH_COMPONENT . DS . 'helpers' . DS . 'foo.php';Joomla 4 / 6
Use this instead
$path = JPATH_COMPONENT . '/helpers/foo.php';How to fix it
- 1Replace DS with '/' inside Joomla paths.
- 2Or use DIRECTORY_SEPARATOR if you concatenate OS paths.
Also known as
DS · directory separator
Related issues
- Joomla 3 → 4PHP
jimport() autoloader calls
jimport('joomla.filesystem.file') → use Joomla\CMS\Filesystem\File;
- Joomla 3 → 4PHP
JPATH_PLATFORM
JPATH_PLATFORM → Do not use — autoload instead
- Joomla 3 → 4Events / plugins
JDispatcher / JEventDispatcher
JDispatcher::getInstance() → Event dispatcher + SubscriberInterface
- Joomla 3 → 4PHP
mysql_* PHP functions
mysql_query() → Joomla DatabaseInterface / mysqli / PDO
- Joomla 3 → 4PHP
each() / create_function() / ereg / split
each($array) → foreach / closures / preg_*
- Joomla 4 → 5PHP
Dynamic PHP properties (PHP 8.2+)
$this->foo = 1 on an untyped class → Declare the property or use AllowDynamicProperties