2023/06/24: Difference between revisions
No edit summary |
No edit summary |
||
Line 42: | Line 42: | ||
I don't know the answer to the above questions, but I did solve the problem: as implied on {{l/mw|Manual:Special_pages}}, the filename ''must'' match the class name -- so it can't be just <tt>Special.php</tt>, it has to be <tt>SpecialClassInspector.php</tt>. (Maybe there's some configuration detail you can put in <tt>extension.json</tt> to override this, but I don't currently know what that is if it exists.) | I don't know the answer to the above questions, but I did solve the problem: as implied on {{l/mw|Manual:Special_pages}}, the filename ''must'' match the class name -- so it can't be just <tt>Special.php</tt>, it has to be <tt>SpecialClassInspector.php</tt>. (Maybe there's some configuration detail you can put in <tt>extension.json</tt> to override this, but I don't currently know what that is if it exists.) | ||
'''2023-07-09 update''': I got this same error again -- this time because of a namespace change. Fixing the extension.json file to have the correct namespace fixed the problem. I conclude (from these two data-points) that this error indicates that the class of the SpecialPage does not match the class referenced in extension.json. |
Latest revision as of 13:26, 9 July 2023
Saturday, June 24, 2023 (#175)
|
Notes
the problem flows like this: in if ( is_array( $rec ) || is_string( $rec ) || is_callable( $rec ) ) {
$page = $this->objectFactory->createObject( $rec, [ 'allowClassName' => true,'allowCallable' => true ]);
}
...which implies that it should be perfectly okay to call createObject() with a string, but then we have if ( is_string( $spec ) && class_exists( $spec ) ) {
if ( empty( $options['allowClassName'] ) ) {
throw new InvalidArgumentException('Passing a raw class name is not allowed here. Use [ \'class\' => $classname ] instead.');
}
return [ 'class' => $spec ];
}
if ( !is_array( $spec ) ) {
throw new InvalidArgumentException( 'Provided specification is not an array.' );
}
...so I think what I'm getting from that is that it's only okay to call So then we have the questions:
I don't know the answer to the above questions, but I did solve the problem: as implied on Manual:Special_pages, the filename must match the class name -- so it can't be just Special.php, it has to be SpecialClassInspector.php. (Maybe there's some configuration detail you can put in extension.json to override this, but I don't currently know what that is if it exists.) 2023-07-09 update: I got this same error again -- this time because of a namespace change. Fixing the extension.json file to have the correct namespace fixed the problem. I conclude (from these two data-points) that this error indicates that the class of the SpecialPage does not match the class referenced in extension.json. |