?
avatar joeforjoomla
joeforjoomla
31 Aug 2017

Steps to reproduce the issue

Call the JHtml class in a case sensitive manner

echo JHTML::_( 'form.token' );

and

echo JHtml::_( 'form.token' );

Expected result

Class is loaded in both cases

Actual result

Class is loaded only as JHtml but no more as JHTML throwing an error
jhtml_not found

System information (as much as possible)

Additional comments

avatar joeforjoomla joeforjoomla - open - 31 Aug 2017
avatar joomla-cms-bot joomla-cms-bot - change - 31 Aug 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 31 Aug 2017
avatar wojsmol
wojsmol - comment - 31 Aug 2017

@laoneo This is probably namespacing issue.

avatar joeforjoomla
joeforjoomla - comment - 31 Aug 2017

This caused a B/C break in several extension still using JHTML flavor to call that class

avatar mbabker
mbabker - comment - 31 Aug 2017

JHTML has been the incorrect way to call the class name for quite some time (since at least 2.5.0 the class has been named as JHtml and in an autoloaded path). In fact you can only use the full uppercase variant if something else has already loaded it into the system either with a manual include or the correctly cased JHtml.

The problem is the autoloader is case sensitive, as is the case with most autoloaders (PHP itself could care less about the casing). The autoloader would never be able to parse the string JHTML and autoload the correct file because of how it processes camel casing.

avatar joeforjoomla
joeforjoomla - comment - 31 Aug 2017

Is there some solutions to avoid a B/C break or all those extensions using JHTML will require a mandatory update?

avatar mbabker
mbabker - comment - 31 Aug 2017

Revert the namespacing PR and force a hard B/C break at 4.0. Literally the only option if you want to account for everyone who has been Doing It Wrong™. You can't alias a single class name with multiple casing variants, PHP considers the class already declared and has an issue with it.

I did some digging. Between 1.5 and 1.6 is when the casing changed. And at some point in 1.7 (before 2.5) is when the autoloader was added. So the all uppercase variants haven't been "right" for years, but if you were either making a call after manually including the class or made a call after something else had loaded JHtml into memory then that's why the full uppercase variation works.

avatar joeforjoomla
joeforjoomla - comment - 31 Aug 2017

You right... but definitely what's the planned answer?

avatar franz-wohlkoenig franz-wohlkoenig - change - 31 Aug 2017
Category Code style
avatar franz-wohlkoenig franz-wohlkoenig - change - 31 Aug 2017
Status New Discussion
avatar ggppdk
ggppdk - comment - 31 Aug 2017

this is surely ok for J4.0
but for J3.8 too ?

now 50% or more of current version of extensions is using JHTML in some of their files or everywhere

and for extensions that have been updated
probably there are custom templates that are using JHTML

avatar joeforjoomla
joeforjoomla - comment - 31 Aug 2017

You right @ggppdk i think it would be a massive B/C break out there... i've just found six extensions using JHTML

Would not be possible to add a class alias in J3.8 to preserve JHTML working and remove it in J4.0?

avatar laoneo
laoneo - comment - 31 Aug 2017

I'm going to make a pr with this variant in the next days. Glad we found it.

avatar joeforjoomla
joeforjoomla - comment - 31 Aug 2017

Thank you @laoneo ... let me know when ready and will test it again

avatar C-Lodder
C-Lodder - comment - 31 Aug 2017

Good shout. I've seen hundreds of users on JSE defining this class in uppercase.

avatar joeforjoomla
joeforjoomla - comment - 31 Aug 2017

As a side note, the same issue could happen with JURI/JUri

avatar esedic
esedic - comment - 1 Sep 2017

Is it the same with getDBO/getDbo?

avatar joeforjoomla
joeforjoomla - comment - 1 Sep 2017

I dont think that's the case for getDBO/getDbo, it's a function call not a class name managed by the autoloader

avatar laoneo
laoneo - comment - 2 Sep 2017

Please test #17834 which should fix the issue. All kind of upper/lower case mixes should now be supported for class aliases in JLoader.

avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Sep 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-09-02 09:26:47
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2017
Closed_Date 2017-09-02 09:26:47 2017-09-02 09:26:48
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 2 Sep 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Sep 2017

closed as havin Pull Request #17834


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

avatar joomla-cms-bot
joomla-cms-bot - comment - 2 Sep 2017

Add a Comment

Login with GitHub to post a comment