Page MenuHomePhabricator

Error from line 139 of PF_HelperFormAction.php: Class 'PFCreateProperty' not found
Closed, ResolvedPublic

Description

Setup

  • MediaWiki 1.30.0 (636a2b9) 22:27, 30 April 2018
  • PHP 7.0.27-0+deb9u1 (apache2handler)
  • MariaDB 10.1.26-MariaDB-0+deb9u1
  • Semantic MediaWiki 3.0.0-alpha (497c969) 20:17, 29 April 2018
  • Page Forms 4.3.1 (8d9c794) 22:21, 22 April 2018

Issue
Creating a property with a form does not work:

[8e8b85fcdd0b19433d330108] /w/index.php?title=Attribut:20160726PersonDateFound&action=formcreate Error from line 139 of /../extensions/PageForms/includes/PF_HelperFormAction.php: Class 'PFCreateProperty' not found

Backtrace

#0 /../extensions/PageForms/includes/PF_HelperFormAction.php(29): PFHelperFormAction::displayForm(PFHelperFormAction, SMW\Page\PropertyPage)
#1 /../includes/MediaWiki.php(499): PFHelperFormAction->show()
#2 /../includes/MediaWiki.php(293): MediaWiki->performAction(SMW\Page\PropertyPage, Title)
#3 /../includes/MediaWiki.php(851): MediaWiki->performRequest()
#4 /../includes/MediaWiki.php(523): MediaWiki->main()
#5 /../index.php(43): MediaWiki->run()
#6 {main}

Event Timeline

Page Forms tries to load the PFCreateProperty class only if SMW is included, and it does that by checking if "defined( 'SMW_VERSION' )". Has that constant been removed from SMW, or renamed?

I believe it is still there however SMW now does extension registration. I would not be surprised if this is connected to this issue.

That might explain it. Is there a more reliable way of checking whether SMW is installed? Checking for the existence of some class, maybe?

According to [0] you should be able to use

ExtensionRegistry::getInstance()->isLoaded( 'SemanticMediaWiki' )

Of course, only when SMW is loaded via wfLoadExtension()...

[0] https://doc.wikimedia.org/mediawiki-core/master/php/classExtensionRegistry.html#a98c5f2c221fce250fe52382ac517a8b8

@Kghbln - could you try changing line 32 of /includes/PF_Hooks.php from:

if ( defined( 'SMW_VERSION' ) ) {

...to:

if ( defined( 'SMW_VERSION' ) || ExtensionRegistry::getInstance()->isLoaded( 'SemanticMediaWiki' ) ) {

...and see if that fixes the problem?

@Yaron_Koren Sorry for coming back to this so late. I just changed the code as suggested and indeed the error goes away! Thanks a lot!

Yaron_Koren claimed this task.

Great! I just merged in the change.

Vvjjkkii renamed this task from Error from line 139 of PF_HelperFormAction.php: Class 'PFCreateProperty' not found to ahdaaaaaaa.Jul 1 2018, 1:11 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Yaron_Koren as the assignee of this task.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Oetterer renamed this task from ahdaaaaaaa to Error from line 139 of PF_HelperFormAction.php: Class 'PFCreateProperty' not found.Jul 1 2018, 6:16 AM
Oetterer closed this task as Resolved.
Oetterer assigned this task to Yaron_Koren.
Oetterer lowered the priority of this task from High to Medium.
Oetterer updated the task description. (Show Details)
Oetterer added a subscriber: Aklapper.