User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Fixes an error on error page if an error occurs after after the template has been parsed (e.g. in a module).
Enable debug.
Edit some backend module file to cause an error. E.g. add foo()
to administrator/modules/mod_menu/mod_menu.php
.
Login to backend.
Error:
The 'atum' service key is already registered.
Error:
Attempted to call function "foo" from the global namespace.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Templates (admin) |
Just thinking: Wouldn't it make more sense to change the register method itself, so it doesn't throw a RuntimeException if the service is already registered? That doesn't sound like an error condition to me, since actually the function did what it was asked to do, just already in an earlier call.
@Bakual the method already has an option for replacing existing service keys. But I don't see the point in re-registering it again here. And it's already done the same way in guest layout:
joomla-cms/administrator/templates/atum/error_login.php
Lines 57 to 63 in 398096a
Yep, I saw the replacement argument, but replacement isn't exactly what we want. Replacement would be to register another class for an existing service, thus replacing the original one.
Imho if the service already exists and replacement isn't set, it could just return empty as there is nothing to do. It doesn't have to raise an exception.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
RTC.
You wouldn't know whether your class was registered or not.
You don't know either with your code. You only know that a service with the name "atum" is registered, not if it is your class.
But I don't really care for now. It was just a thought how it could made easier for all potential instances.
The entire point is that it may not be your class. Some services that aren’t protected may be overloaded.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-07-25 18:30:21 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
I have tested this item✅ successfully on 3ddcf00
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30119.