An extension is needed that has a site/helper/extension.php and an admin/helper/extension.php
In the site helper the class is JHTMLExtension.
In the admin helper the class is JHTMLExtension.
Required: The extension uses the "editor" and the "Button - Field" plugin is published.
No error.
PHP Fatal error: Cannot redeclare class JHTMLExtension in /srv/www/htdocs/administrator/components/com_extension/helpers/extension.php on line 1640, referer: http://...
Joomla! V3.7.2
More commentary can be found here:
https://groups.google.com/forum/#!topic/joomla-dev-general/Pv6LNwb0NQg
https://groups.google.com/forum/#!topic/joomla-dev-general/J_Lwg4Y-2U8
I apologize in advance if this is a design issue with the extension (no more site/helper files??? maybe???)
Thanks for putting up with my first ever issue post.
FJ.
Labels |
Added:
?
|
Category | ⇒ | Administration Libraries |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-06 06:16:34 |
Closed_By | ⇒ | Bakual |
@FlapJackSC, could you please provide us with a call stack (should be provided with the error message, at least when debug is turned on)? The comments suggest, that there actually is a problem with the Fields Button, although I can't see a reason for that in its source (that's why the call stack could help).
Regards,
Niels
Hi Niels,
Thanks for pursuing. I don't get a call stack when debug is on, everything comes to an abrupt halt with a fatal error. (Is that because it's in a plugin?)
It was rather perplexing at first, because it only appeared when calling the editor->display() method. I knew it had to do with something in the new 3.7 code - but I didn't expect it to be the field button plugin - 'cept that was the only new thing that I knew of.
When I stepped through the code (in probably the most inefficient manner possible), I ended up at that extract() method in the administrator/components/com_fields/helpers/fields.php file and discovered that when that JLoader:register() fires, it's registering my components admin helper (which happens to contain a class of the same name as my site side helper - which is already referenced).
Backing up a bit, in the fields plugin (editors-xtd/fields/fields.php). $context, is "get"-ing the option value of my extension and passing it to FieldsHelper::extract(). This results in the inclusion of my admin helper and redeclaration attempt of the class.
Ultimately, I suppose I'm just trying to find out if I need to change the way I have my site helper and admin helper - which isn't a huge deal. Except, it appears this has broken at least a couple extensions that use the editor on the site side with the Field - Button plugin published. And it will break any extensions that have their helpers set up like I do.
I'm sorry I can't get a call stack for you (any tips?), And I hope this rambling helps some what even if you just tell me, "Hey, that's not how the helpers should be used. Give your admin helper class a different name." Or, something similar.
I appreciate you taking the time to reply. (And everyone else - except I'm aware the file is getting included twice and the class can't be declared again - but my extension, isn't attempting to redeclare anything - it's that darned button! : )
Thanks to everyone!
Sincerely,
FJ.
Thank you for your elaboration. The field button (or maybe JLoader) should not produce this kind of error, since currently (in 3.x) it is allowed to have the same class name in administrator and site (that's not longer the case with 4.0).I'll ask the Custom Fields team to have a look at it.
/cc @laoneo
Yes you should not have a helper class with the same name on the front and back end. I suggest to rename your front end helper class.
Please use the forum or Google Group for support requests. This is the issue tracker for code issues in the CMS itself.
Your issue is likely behause the same file (or the same class withing another file) gets included twice and thus the class can't be declared again with the same name.
I'm closing this issue as it's not a core issue.