diff --git a/core/model/schema/modx.mysql.schema.xml b/core/model/schema/modx.mysql.schema.xml index 1d4a75635fb..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 @@ - + @@ -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. --> - + @@ -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. --> - + @@ -746,7 +746,7 @@ - + @@ -779,7 +779,7 @@ - + @@ -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,11 +1035,11 @@ - + - + - + @@ -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 @@ - + 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; }