From 2092a3e65c7705a1eb197050f54119880f2407fd Mon Sep 17 00:00:00 2001 From: Ivan Bochkarev Date: Sun, 8 Mar 2026 22:56:34 +0600 Subject: [PATCH 1/4] fix(schema): use FQCN for modNamespace to resolve PSR-4 deprecation Replace class="modNamespace" with class="MODX\Revolution\modNamespace" in modx.mysql.schema.xml so the profiler and loadClass no longer trigger the v3.0 deprecation warning for short class name. --- core/model/schema/modx.mysql.schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/model/schema/modx.mysql.schema.xml b/core/model/schema/modx.mysql.schema.xml index 1d4a75635fb..ffcf8177870 100644 --- a/core/model/schema/modx.mysql.schema.xml +++ b/core/model/schema/modx.mysql.schema.xml @@ -693,7 +693,7 @@ Development namespacing object by which MODX extension development is done. Provides a centralized path location and grouping name for organizing development silos within MODX. --> - + From 4eeffc475e5b4b739a69062d50c480d1da4f9b32 Mon Sep 17 00:00:00 2001 From: Ivan Bochkarev Date: Sun, 8 Mar 2026 23:01:09 +0600 Subject: [PATCH 2/4] fix(schema): use FQCN for modPlugin, modPluginEvent, modSystemSetting Replace short class names with MODX\Revolution\ FQCN in modx.mysql.schema.xml to resolve PSR-4 deprecation warnings in profiler (v3.0). --- core/model/schema/modx.mysql.schema.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/model/schema/modx.mysql.schema.xml b/core/model/schema/modx.mysql.schema.xml index ffcf8177870..268745d3fae 100644 --- a/core/model/schema/modx.mysql.schema.xml +++ b/core/model/schema/modx.mysql.schema.xml @@ -746,7 +746,7 @@ - + @@ -779,7 +779,7 @@ - + @@ -1039,7 +1039,7 @@ - + From 8c2c4c6be87788e989d7ddd4cb30484fcafc7514 Mon Sep 17 00:00:00 2001 From: Ivan Bochkarev Date: Sun, 8 Mar 2026 23:06:03 +0600 Subject: [PATCH 3/4] fix(schema): use FQCN for all remaining mod* classes in schema Replace short class names with MODX\Revolution\* for modAccess, modMenu, modResource, modUser, modTemplate, modChunk, modSnippet, modCategory, modContext, modEvent, modFormCustomization*, modTemplateVar*, modUserGroup*, and all other core model classes in modx.mysql.schema.xml to resolve PSR-4 deprecation warnings (v3.0). --- core/model/schema/modx.mysql.schema.xml | 134 ++++++++++++------------ 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/core/model/schema/modx.mysql.schema.xml b/core/model/schema/modx.mysql.schema.xml index 268745d3fae..906e85ee1d4 100644 --- a/core/model/schema/modx.mysql.schema.xml +++ b/core/model/schema/modx.mysql.schema.xml @@ -11,7 +11,7 @@ --> - + @@ -49,11 +49,11 @@ - + - + @@ -64,7 +64,7 @@ - + @@ -75,11 +75,11 @@ - + - + @@ -90,13 +90,13 @@ - + - + - + @@ -104,11 +104,11 @@ - + - + @@ -135,7 +135,7 @@ - + @@ -146,14 +146,14 @@ - + - + @@ -169,7 +169,7 @@ - + @@ -180,7 +180,7 @@ - + @@ -202,7 +202,7 @@ Form customisation Defines rules (like, hide/move a field) that are applied on a specific action (controller, like resource/update) --> - + @@ -245,7 +245,7 @@ Form customisation Defines the fields that are available on an action (controller, like resource/update) that can be manipulated --> - + @@ -267,7 +267,7 @@ - + @@ -282,7 +282,7 @@ - + @@ -325,7 +325,7 @@ - + @@ -339,7 +339,7 @@ - + @@ -377,7 +377,7 @@ - + @@ -396,7 +396,7 @@ - + @@ -421,7 +421,7 @@ - + @@ -439,7 +439,7 @@ - + @@ -453,7 +453,7 @@ - + @@ -471,7 +471,7 @@ - + @@ -500,7 +500,7 @@ - + @@ -521,9 +521,9 @@ - + - + @@ -532,7 +532,7 @@ - + @@ -547,7 +547,7 @@ - + @@ -559,7 +559,7 @@ - + @@ -571,7 +571,7 @@ - + @@ -591,7 +591,7 @@ - + @@ -619,7 +619,7 @@ - + @@ -644,7 +644,7 @@ - + @@ -659,7 +659,7 @@ - + @@ -718,7 +718,7 @@ models to be loaded prior to modX request handling. Useful for when you want to integrate custom data and extensions, such as Custom Resource Classes, into the core. --> - + @@ -798,11 +798,11 @@ - + - + @@ -819,7 +819,7 @@ - + @@ -941,7 +941,7 @@ - + @@ -955,7 +955,7 @@ - + @@ -970,7 +970,7 @@ - + @@ -986,7 +986,7 @@ - + @@ -1003,7 +1003,7 @@ - + @@ -1035,9 +1035,9 @@ - + - + @@ -1055,7 +1055,7 @@ - + @@ -1096,7 +1096,7 @@ - + @@ -1147,7 +1147,7 @@ - + @@ -1167,7 +1167,7 @@ - + @@ -1180,7 +1180,7 @@ - + @@ -1194,7 +1194,7 @@ - + @@ -1236,7 +1236,7 @@ - + @@ -1263,7 +1263,7 @@ - + @@ -1281,7 +1281,7 @@ - + @@ -1296,7 +1296,7 @@ - + @@ -1314,7 +1314,7 @@ - + @@ -1328,7 +1328,7 @@ - + @@ -1362,7 +1362,7 @@ - + @@ -1380,9 +1380,9 @@ - + - + @@ -1402,7 +1402,7 @@ - + @@ -1414,7 +1414,7 @@ - + From 88ce42f335b6d0305ef039708047486975c40a2f Mon Sep 17 00:00:00 2001 From: Ivan Bochkarev Date: Sun, 8 Mar 2026 23:23:15 +0600 Subject: [PATCH 4/4] fix(loadClass): normalize short mod* names to FQCN for PSR-4 compatibility Add isShortModClassName() helper and runtime normalization in loadClass(). Short names (modResource, modAccessContext, etc.) are converted to MODX\Revolution\* FQCN to avoid deprecation from xPDO call paths. Creates class_alias for backward compatibility. --- core/src/Revolution/modX.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/core/src/Revolution/modX.php b/core/src/Revolution/modX.php index e17de52e8f7..ca08281f65d 100644 --- a/core/src/Revolution/modX.php +++ b/core/src/Revolution/modX.php @@ -2516,12 +2516,29 @@ private function _getDeprecatedMethod($since, $callerDef, $recommendation): modD } + /** + * Check if the given value is a short mod* class name (e.g. modResource, modAccessContext). + * + * @param mixed $className Class name as passed by caller. + * @return bool True if it matches mod[A-Za-z]+ without namespace. + */ + public static function isShortModClassName($className): bool + { + return is_string($className) + && $className !== '' + && strpos($className, '\\') === false + && preg_match('/^mod[A-Za-z]+$/', $className); + } + /** * Load a class by fully qualified name. * * As of MODX 3.0, this is no longer necessary and deprecated. Instead of using loadClass, use the PSR-4 class * references that are available through the autoloader. * + * Short mod* names (modResource, modAccessContext, etc.) are normalized to FQCN internally to avoid deprecation + * spam from xPDO call paths that invoke loadClass before modAccessibleObject::load. + * * @param string $fqn * @param string $path * @param bool $ignorePkg @@ -2531,7 +2548,15 @@ private function _getDeprecatedMethod($since, $callerDef, $recommendation): modD */ public function loadClass($fqn, $path = '', $ignorePkg = false, $transient = false) { + $originalFqn = $fqn; + if (self::isShortModClassName($fqn)) { + $fqn = 'MODX\\Revolution\\' . $fqn; + } + if (strpos($fqn, '\\') !== false && class_exists($fqn)) { + if ($originalFqn !== $fqn && !class_exists($originalFqn)) { + class_alias($fqn, $originalFqn); + } return $fqn; }