[BUG]: edge case: Powers inside Powers not validated #1229

Closed
opened 2025-06-26 10:59:49 +00:00 by Tom van der Laan · 1 comment

What Happened?

I am refactoring and i am replacing all my ComponentHelper with the corresponding Joomla Power SPK.

I have custom codes for every function i use inside my helper class. So i was calling another function before.

But since this is called inside the Helper class it adds a use statement that breaks things. I've changed it to self:: now instead. But that makes the custom code a bit less flexible. Of course this would not be an issue if i moved my helpers to it's own powers.

I just wanted to let you know of this use case. Please close the bug report if you find that this is expected behaviour and it's not something that should be catched during replacement of these SPK's.

Steps to reproduce the Bug

add Joomla___cf3b95c1_ba56_4193_8eb4_9164582b7f55___Power class to a custom code and add this to the component powers area.

It'll add a use Statement (to be expected) but in this file it breaks stuff.

Which Joomla version are you compiling in?

5

Which PHP version are you compiling in?

8.3

Which Joomla versions are you targeting?

5

Which PHP version are you targeting?

8.3

Which Web server is JCB running on?

litespeed

Which Relational Database is JCB running on?

mariadb 10.11

Which OS is JCB running on?

almalinux 9

Which JCB version are you using?

latest 5.1 alpha 5

Where in JCB did this issue occur?

Compilation of a component

On which browsers did you encounter the issue?

Firefox

Additional Comments

No response

### What Happened? I am refactoring and i am replacing all my ComponentHelper with the corresponding Joomla Power SPK. I have custom codes for every function i use inside my helper class. So i was calling another function before. But since this is called inside the Helper class it adds a use statement that breaks things. I've changed it to self:: now instead. But that makes the custom code a bit less flexible. Of course this would not be an issue if i moved my helpers to it's own powers. I just wanted to let you know of this use case. Please close the bug report if you find that this is expected behaviour and it's not something that should be catched during replacement of these SPK's. ### Steps to reproduce the Bug add Joomla___cf3b95c1_ba56_4193_8eb4_9164582b7f55___Power class to a custom code and add this to the component powers area. It'll add a use Statement (to be expected) but in this file it breaks stuff. ### Which Joomla version are you compiling in? 5 ### Which PHP version are you compiling in? 8.3 ### Which Joomla versions are you targeting? 5 ### Which PHP version are you targeting? 8.3 ### Which Web server is JCB running on? litespeed ### Which Relational Database is JCB running on? mariadb 10.11 ### Which OS is JCB running on? almalinux 9 ### Which JCB version are you using? latest 5.1 alpha 5 ### Where in JCB did this issue occur? Compilation of a component ### On which browsers did you encounter the issue? Firefox ### Additional Comments _No response_
Tom van der Laan added the
Bug
label 2025-06-26 10:59:49 +00:00
Owner

Thanks... yes you will need to avoid using the class name in a helper class but instead use self:: would ensure this does not happen. There is really no automated JCB way to predict this and avoid this.

Thanks... yes you will need to avoid using the class name in a helper class but instead use `self::` would ensure this does not happen. There is really no automated JCB way to predict this and avoid this.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1229
No description provided.