? Pending

User tests: Successful: Unsuccessful:

avatar stutteringp0et
stutteringp0et
6 Dec 2017

[4.0] [com_fields] Error when creating field

Pull Request for Issue #18920 .

Summary of Changes

getTable method doesn't need name or prefix value to load the correct table class

Testing Instructions

Attempting to create a field in a fresh install results in "Component\Fields\Administrator\Table\Field' not found"

Expected result

Field is saved

Actual result

Error: Component\Fields\Administrator\Table\Field' not found

Documentation Changes Required

This restores normal function

avatar stutteringp0et stutteringp0et - open - 6 Dec 2017
avatar stutteringp0et stutteringp0et - change - 6 Dec 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Dec 2017
Category Administration com_fields
avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

Something is wrong with the build configurations - the tests are erroring out on libsodium
Travis-PHP7: configure: error: wrong libsodium lib version (< 1.0.8) or lib not found
Travis-PHP7.1: configure: error: wrong libsodium lib version (< 1.0.8) or lib not found
appveyor-PHP7:

  • = - = not installed. The package was not found with the source(s) listed.
  • vc14 - vc14 not installed. The package was not found with the source(s) listed.
  • x64 - x64 not installed. The package was not found with the source(s) listed.

appveyor-PHP7.1:

  • = - = not installed. The package was not found with the source(s) listed.
  • vc14 - vc14 not installed. The package was not found with the source(s) listed.
  • x64 - x64 not installed. The package was not found with the source(s) listed.

Someone needs to look into that.

avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Dec 2017
Title
Fix getTable method
[4.0] Fix getTable method
avatar joomla-cms-bot joomla-cms-bot - edited - 6 Dec 2017
avatar stutteringp0et stutteringp0et - change - 6 Dec 2017
Labels Added: ?
avatar stutteringp0et stutteringp0et - change - 6 Dec 2017
Title
[4.0] Fix getTable method
[4.0] Fix FieldModel::getTable method
avatar stutteringp0et stutteringp0et - edited - 6 Dec 2017
avatar joomdonation
joomdonation - comment - 6 Dec 2017

Could you please check to see whether you got this issue with latest 4.0-dev branch? I could not re-procedure the issue and this fix is not correct to me

The only change needed is change the code in this line https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_fields/Model/FieldModel.php#L404 from:

public function getTable($name = 'Field', $prefix = 'FieldsTable', $options = array())

To:

public function getTable($name = 'Field', $prefix = 'Administrator', $options = array())

Even without that change, the table class should still be found because we have code to fallback to Administrator when an invalid $prefix is passed, see https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/Factory/MVCFactory.php#L129

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

I'm cloning the current 4.0-dev branch now - which is a real pain over satellite.

When I adjust getTable to use Fields and Administrator - I get the same error as before

Class 'Joomla\Component\Fields\Administrator\Table\Field' not found

I looked at that last night (with those values), and trying different combinations while watching the createTable vars in MVCFactory.

I'll try again when the clone is finished.

avatar joomdonation
joomdonation - comment - 6 Dec 2017

The class name you mentioned is wrong somehow. If you look at this code https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/MVC/Factory/MVCFactory.php#L129, the class name should be Joomla\Component\Fields\Administrator\Table\FieldTable, so it is correct class and should not cause the error

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

The output of MVCFactory::createTable is Joomla\Component\Fields\Administrator\Table\FieldTable - however, the error shows Joomla\Component\Fields\Administrator\Table\Field

That's what prompted me to try the com_content ArticleTable method - an empty class with the correct name (the name from the error) that extends FieldTable.

avatar mbabker
mbabker - comment - 6 Dec 2017

If we need blank stub classes then we're doing something wrong. That is the issue that needs to be fixed.

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

By the way - if I change the getTable input to FieldTable and Administrator - the error changes to: Table FieldTable not supported. File not found.

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

I don't think I'll be able to test against 4.0-dev in the next 11 minutes. Today is my sons birthday and he gets the whole day - so I'll be back on this tonight.

avatar joomdonation
joomdonation - comment - 6 Dec 2017

Sorry I could not see the issue myself, so I could not check it further. Maybe it happens in special condition, hopefully you can find out the root cause of the issue for a proper fix.

avatar mbabker
mbabker - comment - 6 Dec 2017

If someone can post a backtrace (should be able to get it with debug mode enabled) that'd be helpful.

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

Call stack

Function Location

1 () JROOT/administrator/components/com_fields/Table/FieldTable.php:115
2 Joomla\Component\Fields\Administrator\Table\FieldTable->check() JROOT/libraries/src/MVC/Model/AdminModel.php:1167
3 Joomla\CMS\MVC\Model\AdminModel->save() JROOT/administrator/components/com_fields/Model/FieldModel.php:148
4 Joomla\Component\Fields\Administrator\Model\FieldModel->save() JROOT/libraries/src/MVC/Controller/FormController.php:726
5 Joomla\CMS\MVC\Controller\FormController->save() JROOT/libraries/src/MVC/Controller/BaseController.php:710
6 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/Dispatcher.php:165
7 Joomla\CMS\Dispatcher\Dispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:423
8 Joomla\CMS\Component\ComponentHelper::dispatchComponent() JROOT/libraries/src/Component/ComponentHelper.php:364
9 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:106
10 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:149
11 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:340
12 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:35
13 require_once() JROOT/administrator/index.php:30

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

I still don't have 4.0-dev yet to test - Downloading 4th retry, connection keeps getting terminated. The joys of satellite internet.

avatar mbabker
mbabker - comment - 6 Dec 2017

So if that trace is right then there's something really wrong.

new static; shouldn't be instantiating a new instance of that class with a different class name...

avatar stutteringp0et
stutteringp0et - comment - 6 Dec 2017

Download completed - the issue does not exist in 4.0-dev

Closing this PR - thanks for the guidance @mbabker @joomdonation

avatar stutteringp0et stutteringp0et - change - 6 Dec 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-12-06 15:04:32
Closed_By stutteringp0et
avatar stutteringp0et stutteringp0et - close - 6 Dec 2017

Add a Comment

Login with GitHub to post a comment