Try to run stubGenerator.php
Creates a stubs.php file
Creates fatal error:
Fatal error: Cannot use Joomla\CMS\Table\Observer\ContentHistory as ContentHistory because the name is already in use in D:\xampp\htdocs\joomla\libraries\src\Table\Category.php on line 15
Call Stack:
0.0003 355000 1. {main}() D:\xampp\htdocs\joomla\build\stubGenerator.php:0
2.1262 2510496 2. Joomla\CMS\Application\CliApplication->execute() D:\xampp\htdocs\joomla\build\stubGenerator.php:90
2.1262 2510496 3. StubGenerator->doExecute() D:\xampp\htdocs\joomla\libraries\src\Application\CliApplication.php:145
2.1540 5253376 4. ReflectionClass->__construct() D:\xampp\htdocs\joomla\build\stubGenerator.php:75
2.1540 5253520 5. spl_autoload_call() D:\xampp\htdocs\joomla\build\stubGenerator.php:75
2.1540 5253608 6. JLoader::loadByPsr4() D:\xampp\htdocs\joomla\build\stubGenerator.php:75
Removing the line https://github.com/joomla/joomla-cms/blob/staging/libraries/classmap.php#L61 solves the issue, but isn't the right solution I guess.
I'm not sure if that is an issue only in the stubGenerator script or if that is something which can happen in production as well.
Labels |
Added:
?
|
Category | ⇒ | Libraries |
Status | New | ⇒ | Discussion |
unable to replicate, runned stubGenerator.php but
stubs.php file created without Fatal error
unable to replicate, runned stubGenerator.php but
On current staging? That's strange.
worked for me too
May that be related to the PHP version? Mine is 7.0.4 (XAMPP on Windows). But given Michaels explanation I would expect it to fail on all versions anyway.
yes current staging, mine PHP is 7.0.22 ubuntu
Updated now XAMPP to PHP 7.1.8 and it works again. So looks indeed like a bug in 7.0.4. I've read that it was fixed with PHP 7.0.7.
I'm closing this issue then.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-08-29 06:51:10 |
Closed_By | ⇒ | Bakual |
FYI this issue occurs as well while retrieving a JTable instance for "Category" (JTable::getInstance('Category')) with PHP 5.6.38.
Moving to PHP 7.1.22 is solving the issue.
Nope, not the right fix.
Need to do
use Joomla\CMS\Table\Observer\ContentHistory as ContentHistoryObserver;
in that file then changes references to the observer to use the aliased name.There's both a
Joomla\CMS\Table\Observer\ContentHistory
andJoomla\CMS\Table\ContentHistory
and you can't reference the same short name twice in one file. SinceJoomla\CMS\Table\Category
is in the namespace as the latter, it's automatically referencing the class in the same namespace first (PHP behavior).