PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar HLeithner
HLeithner
21 Sep 2023

Pull Request for Issue #41835 .

Summary of Changes

Removes the contenthistory alias from the b/c plugin

Testing Instructions

Activate b/c plugin
create an article
check versions

Actual result BEFORE applying this Pull Request

2 times the error message

Warning
: Cannot declare class \joomla\cms\table\contenttype, because the name is already in use in
/web/darmplus.verlauf.at/libraries/loader.php
on line
576

Expected result AFTER applying this Pull Request

no error message

currently with this pr only one time

avatar joomla-cms-bot joomla-cms-bot - change - 21 Sep 2023
Category Front End Plugins
avatar HLeithner HLeithner - open - 21 Sep 2023
avatar HLeithner HLeithner - change - 21 Sep 2023
Status New Pending
avatar HLeithner
HLeithner - comment - 21 Sep 2023

hmm the solution seems not to be right... because this would fail Table::getInstance()

avatar HLeithner
HLeithner - comment - 21 Sep 2023

have to look at it later

avatar Fedik
Fedik - comment - 22 Sep 2023

I think we can remove whole section

// Special cases for renamed PascalCase table names which could not be autodetected by the new Table::getInstance function
JLoader::registerAlias('\\Joomla\\CMS\\Table\\Updatesite', '\\Joomla\\CMS\\Table\\UpdateSite', '6.0');
JLoader::registerAlias('\\Joomla\\CMS\\Table\\Viewlevel', '\\Joomla\\CMS\\Table\\ViewLevel', '6.0');
JLoader::registerAlias('\\Joomla\\CMS\\Table\\Contenthistory', '\\Joomla\\CMS\\Table\\ContentHistory', '6.0');
JLoader::registerAlias('\\Joomla\\CMS\\Table\\Contenttype', '\\Joomla\\CMS\\Table\\ContentType', '6.0');
JLoader::registerAlias('\\Joomla\\CMS\\Table\\Corecontent', '\\Joomla\\CMS\\Table\\CoreContent', '6.0');

It does not make any sense, because the class is case insensetive:

class Foo { }

class_alias('Foo', 'Bar');

var_dump(new bar);

Also when removed, the following still works:

var_dump(Table::getInstance('contenttype'));
var_dump(Table::getInstance('ContentType'));

@wilsonge can you confirm, or maybe I missed something

avatar Fedik
Fedik - comment - 22 Sep 2023

btw, this does not work anyway:

new Joomla\CMS\Table\Contenttype(Factory::getDbo()); // Throws class not found error
new Joomla\CMS\Table\ContentType(Factory::getDbo()); // Works
new JTableContenttype(Factory::getDbo()); // Works

And when change order:

new Joomla\CMS\Table\ContentType(Factory::getDbo()); // Works
new JTableContenttype(Factory::getDbo()); // Works
new Joomla\CMS\Table\Contenttype(Factory::getDbo()); // Works

Joomla 4 and 5

avatar HLeithner
HLeithner - comment - 22 Sep 2023

I thinks it's about the class override in the container maybe?

avatar Fedik
Fedik - comment - 22 Sep 2023

I do not think that it related to container in any way

avatar HLeithner HLeithner - change - 22 Sep 2023
Labels Added: PR-5.0-dev
avatar HLeithner
HLeithner - comment - 22 Sep 2023

I now removed the other case changed class aliases too.

avatar HLeithner
HLeithner - comment - 22 Sep 2023

@hendrikbehncke can you please test this pull request.

avatar alikon
alikon - comment - 22 Sep 2023

no more warning with the pr

avatar alikon alikon - test_item - 22 Sep 2023 - Tested successfully
avatar alikon
alikon - comment - 22 Sep 2023

I have tested this item ✅ successfully on 81971c7


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41853.

avatar HLeithner HLeithner - change - 22 Sep 2023
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-09-22 18:28:56
Closed_By HLeithner
avatar HLeithner HLeithner - close - 22 Sep 2023
avatar HLeithner HLeithner - merge - 22 Sep 2023
avatar HLeithner
HLeithner - comment - 22 Sep 2023

thanks

Add a Comment

Login with GitHub to post a comment