Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: defined() used for function #1173

Closed
FrancoisChaumont opened this issue Aug 19, 2024 · 2 comments · Fixed by #1174
Closed

Bug: defined() used for function #1173

FrancoisChaumont opened this issue Aug 19, 2024 · 2 comments · Fixed by #1174
Labels
bug Something isn't working

Comments

@FrancoisChaumont
Copy link
Contributor

PHP Version

8.3

CodeIgniter4 Version

4.5.4

Shield Version

dev-develop 223fbd9

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

MySQL 8.0.39

Did you customize Shield?

No

What happened?

In an attempt to create an email_helper and override the emailer function the system produces an error trying to redefine that function because the verification of a previously defined function of identical name is done using defined instead of function_exists.

Steps to Reproduce

Copy codeigniter4/shield/src/email_helper.php into app/Helpers

Expected Output

No error when overriding the emailer function

Anything else?

No response

@FrancoisChaumont FrancoisChaumont added the bug Something isn't working label Aug 19, 2024
@datamweb
Copy link
Collaborator

@FrancoisChaumont , Thank you for bringing this issue to our attention!

If you’re able to, we would encourage you to submit a Pull Request (PR) to address this issue. It would be great if you could refactor the code to use function_exists() instead of defined(), which will help prevent errors related to function redefinitions. Also, please make sure your GPG key is configured on your GitHub account before submitting the PR, as it is required for signature verification.

Additionally, could you please provide more details on why you need to override the helper function?

@datamweb datamweb changed the title Bug: defined used for function Bug: defined() used for function Aug 19, 2024
@FrancoisChaumont
Copy link
Contributor Author

Hey @datamweb, Thanks for taking the time to get back to me about this.

Sure thing, I'll submit a PR in a little bit.

Overriding the helper was considered as an intent to white-label an existing solution (especially config values) but it turns out (after some head banging against the wall) that it's even necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants