J4 Issue ?
avatar aaron-harding
aaron-harding
30 Jul 2018

Steps to reproduce the issue

Attempt to Install latest branch of Joomla after composer install and npm install

Expected result

Go to Joomla install process

Actual result

Fatal error: Cannot use Joomla\CMS\Factory as Factory because the name is already in use in C:\xxx\joomla-cms\libraries\src\Document\HtmlDocument.php on line 18

System information (as much as possible)

PHP 7.1.20

Additional comments

Each Document class uses Joomla\CMS\Factory, Factory is already assigned to Joomla\CMS\Document\Factory.

I updated the use statement to use Joomla\CMS\Factory as FactoryCMS and updated each reference to FactoryCMS in each of the Document classes which seems to fix it. I'm not sure if making this change has caused other side effects?

avatar aaron-harding aaron-harding - open - 30 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - change - 30 Jul 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Jul 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Jul 2018
Category Repository
avatar aaron-harding aaron-harding - change - 30 Jul 2018
Title
Factory class conflict in Joomla/CMS/Document namespace
[4.0] Factory class conflict in Joomla/CMS/Document namespace
avatar aaron-harding aaron-harding - edited - 30 Jul 2018
avatar brianteeman brianteeman - change - 30 Jul 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 30 Jul 2018
avatar wilsonge
wilsonge - comment - 1 Aug 2018

I updated the use statement to use Joomla\CMS\Factory as FactoryCMS and updated each reference to FactoryCMS in each of the Document classes which seems to fix it. I'm not sure if making this change has caused other side effects?

That's a good fix - can you make that as a pull request please?

avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Aug 2018
Status New Information Required
avatar brianteeman
brianteeman - comment - 10 Aug 2018

Can you still replicate this issue?

I am surprised that no one else has seen this as its a fatal error in the installer so there will be a lot of people who have run the installer

avatar aaron-harding
aaron-harding - comment - 13 Aug 2018

@brianteeman Just pulled latest branch and still getting the same error.

Fatal error: Cannot use Joomla\CMS\Factory as Factory because the name is already in use in C:\xampp\htdocs\joomla-cms\libraries\src\Document\HtmlDocument.php on line 14

As it is in the HtmlDocument class, I'm not sure if this is only related to the installer as this class is used for most rendering on the site? I just can't get past the installer at the moment to test this.

When I do my suggested solution it then complains of a similar issue but in the class Joomla\CMS\Document\Document. If I make the same fix in that class I can then see the installer setup but this then breaks when coming to installing the database. Upon inspection I am again getting the same error in Joomla\CMS\Document\JsonDocument. Every Document class that uses Joomla\CMS\Factory is having the conflict.

avatar brianteeman
brianteeman - comment - 13 Aug 2018

Exactly where/when do you get that error

avatar brianteeman
brianteeman - comment - 13 Aug 2018

I have done about twenty installs this morning and I didnt have any errors

avatar wilsonge
wilsonge - comment - 13 Aug 2018

I'm not quite sure why you're the only person getting this - but it is reasonably obviously wrong. So I've patched it with 561e721

avatar wilsonge wilsonge - change - 13 Aug 2018
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2018-08-13 10:33:14
Closed_By wilsonge
avatar wilsonge wilsonge - close - 13 Aug 2018
avatar garkell
garkell - comment - 23 Aug 2018

I know this is closed, but I just had the same error after installing the latest nightly build over a failed upgrade install. My error was in ErrorDocument.php. As a test I performed the same changes as above and got passed this problem, but then had another issue. Do you want a new issue raised for this or is there further activity already in progress? Cheers.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 Aug 2018

@garkell can you please open a new Issue about "another issue" (and reference to this issue)?

avatar wilsonge
wilsonge - comment - 23 Aug 2018

ErrorDocument patched with 4d46a67 - thanks for the report :)

Add a Comment

Login with GitHub to post a comment