Last modified: 2014-05-30 17:26:28 UTC
Fatal error: Class '\ValueValidators\RangeValidator' not found in {...}/extensions/Validator/includes/ParamProcessor/ParamDefinitionFactory.php on line 181 Errors like this pop up on PHP 5.3. This is because the behaviour for `new $class()` is different between 5.3 and 5.4. For this: new \Foo\Bar(); In both 5.3 and 5.4 the autoloader will get the string 'Foo\Bar'. But for this: $class = '\Foo\Bar'; new $class(); PHP 5.4 will clean up the class name and the autoloader will get the string 'Foo\Bar'. PHP 5.3 will leave it alone and the autoloader will get the string '\Foo\Bar'. As a result when class names like '\ValueValidators\RangeValidator' and '\ValueValidators\NullValidator' are used, PHP 5.3 won't find any class. ParamDefinitionFactory::newDefinition needs to strip leading \'s from $validator, do it's comparison against '\ValueValidators\NullValidator', and in the future callers should ideally avoid calling it with the leading \.
This is about using PHP 5.3 with an old version of MW? I seem to recall the MW autoloder being fixed quite some time ago, since this was a problem for Wikidata. Also, old version of Validator? Please specify.
PHP is 5.3 The MW version and Validator are what is checked into the client tree. MW is some version of 1.22 (alpha?). And I'm not sure about Validator, it's a little old but the version is something like 1.0 beta so it's not too far behind the current. I've confirmed that the ParamParser library itself is still doing raw comparisons against '\ValueValidators\NullValidator' which would be incorrect in any case. I'll note that MediaWiki's autoloader is actually not used for this code, but after looking even further the spl autoloader function used has been updated to trim \\ so in theory this is fixed (though code should still avoid comparison against '\ValueValidators\NullValidator').
I'm not sure what to mark this as duplicate of.