diff --git a/build/phpstan/joomla-bootstrap.php b/build/phpstan/joomla-bootstrap.php index c285e232b6c25..21178069ab352 100644 --- a/build/phpstan/joomla-bootstrap.php +++ b/build/phpstan/joomla-bootstrap.php @@ -10,7 +10,6 @@ */ \define('_JEXEC', 1); -\define('JPATH_PLATFORM', 1); \define('JPATH_BASE', \dirname(__DIR__, 2)); // Load the Joomla environment diff --git a/build/psr12/clean_errors.php b/build/psr12/clean_errors.php index 257cd183d49f8..3db025ea466fd 100644 --- a/build/psr12/clean_errors.php +++ b/build/psr12/clean_errors.php @@ -40,10 +40,6 @@ "defined('_JEXEC') or die();", "\defined('_JEXEC') or die;", "defined('_JEXEC') or die;", - "\defined('JPATH_PLATFORM') or die();", - "defined('JPATH_PLATFORM') or die();", - "\defined('JPATH_PLATFORM') or die;", - "defined('JPATH_PLATFORM') or die;", "\defined('JPATH_BASE') or die();", "defined('JPATH_BASE') or die();", "\defined('JPATH_BASE') or die;", diff --git a/libraries/bootstrap.php b/libraries/bootstrap.php index 190240a730ee6..713e69ce985f9 100644 --- a/libraries/bootstrap.php +++ b/libraries/bootstrap.php @@ -10,14 +10,6 @@ defined('_JEXEC') or die; -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -defined('JPATH_PLATFORM') or define('JPATH_PLATFORM', __DIR__); - // Detect the native operating system type. $os = strtoupper(substr(PHP_OS, 0, 3)); diff --git a/libraries/cms.php b/libraries/cms.php index 03f8203174b7b..b117d028f755d 100644 --- a/libraries/cms.php +++ b/libraries/cms.php @@ -18,16 +18,6 @@ E_USER_DEPRECATED ); -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', __DIR__); -} - // Import the library loader if necessary if (!class_exists('JLoader')) { require_once JPATH_LIBRARIES . '/loader.php'; diff --git a/libraries/import.legacy.php b/libraries/import.legacy.php index 60ea147aaa017..0a79a5d06722d 100644 --- a/libraries/import.legacy.php +++ b/libraries/import.legacy.php @@ -17,16 +17,6 @@ E_USER_DEPRECATED ); -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', __DIR__); -} - // Detect the native operating system type. $os = strtoupper(substr(PHP_OS, 0, 3)); diff --git a/libraries/import.php b/libraries/import.php index cc87ee797a32f..020761674cb8d 100644 --- a/libraries/import.php +++ b/libraries/import.php @@ -17,16 +17,6 @@ E_USER_DEPRECATED ); -/** - * Set the platform root path as a constant if necessary. - * - * @deprecated 4.4.0 will be removed in 6.0 - * Use defined('_JEXEC') or die; to detect if the CMS is loaded correctly - **/ -if (!defined('JPATH_PLATFORM')) { - define('JPATH_PLATFORM', __DIR__); -} - // Detect the native operating system type. $os = strtoupper(substr(PHP_OS, 0, 3)); diff --git a/plugins/behaviour/compat/src/Extension/Compat.php b/plugins/behaviour/compat/src/Extension/Compat.php index 7232a8866269a..ceecc2d2e6547 100644 --- a/plugins/behaviour/compat/src/Extension/Compat.php +++ b/plugins/behaviour/compat/src/Extension/Compat.php @@ -74,6 +74,12 @@ public function __construct(DispatcherInterface $dispatcher, array $config = []) if ($this->params->get('classes_aliases', '1')) { require_once \dirname(__DIR__) . '/classmap/classmap.php'; } + + /** + * Load the constant early as it is used in class files before the class itself is loaded. + * @deprecated 4.4.0 will be removed in 7.0 + */ + \defined('JPATH_PLATFORM') or \define('JPATH_PLATFORM', __DIR__); } /** diff --git a/tests/Unit/bootstrap.php b/tests/Unit/bootstrap.php index c506928078569..bc296b8d08349 100644 --- a/tests/Unit/bootstrap.php +++ b/tests/Unit/bootstrap.php @@ -35,13 +35,6 @@ \define('JPATH_ROOT', JPATH_BASE); } -/** - * @deprecated 4.4.0 will be removed in 6.0 - **/ -if (!\defined('JPATH_PLATFORM')) { - \define('JPATH_PLATFORM', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); -} - if (!\defined('JPATH_LIBRARIES')) { \define('JPATH_LIBRARIES', JPATH_BASE . DIRECTORY_SEPARATOR . 'libraries'); }