https://bugzilla.wikimedia.org/show_bug.cgi?id=65932

            Bug ID: 65932
           Summary: Validator/ParamParser broken on 5.3 due to autoloader
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Validator
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
       Web browser: ---
   Mobile Platform: ---

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 \.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to