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

Fix ldap_contacts error running under php8.2 & remove unused and correct ldap .env variable #869

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

Shadow243
Copy link
Member

@Shadow243 Shadow243 commented Jan 16, 2024

Issue: Resolve Array Key Exists Error in Cypht with PHP 8.2

Problem Description:

Under the PHP 8.2 environment in Cypht, an error is encountered in the ldap_contacts module, specifically on line 320. The error is related to array_key_exists() where a string is given instead of an array. Notably, this error is not displayed under PHP 7.4. The issue occurs on pages such as settings and compose, leading to an error page.

Steps to Reproduce:

  1. Set up Cypht with PHP 8.2.
  2. Navigate to the settings or compose page.
  3. Observe the error related to array_key_exists() on line 320 in the ldap_contacts module.

Proposed Changes:

Code Modification:

  • Investigate and resolve the issue causing the array_key_exists() error in the ldap_contacts module under PHP 8.2.
  • Ensure compatibility with PHP 8.2, and 8.3 without compromising functionality in PHP 7.4.

Cleanup:

  • Remove unused environment variables from the .env.example file.
  • Rename the LDAP_AUTH variable in .env.example according to config/ldap.php file.

Additional Information:

  • The error seems specific to the interaction between Cypht and PHP 8.2.
  • No such error is observed when using PHP 7.4.
  • Clean up the environment variable configuration for better maintenance.

Environment:

  • PHP 8.2
  • Cypht
  • Ubuntu server on Digital Ocean

Steps to Test:

  1. Apply the code modifications.
  2. Confirm the error is resolved under PHP 8.2.
  3. Verify that functionality remains intact under PHP 7.4.
  4. Test the cleanup changes related to environment variables.

Related Issues:

N/A

@josaphatim
Copy link
Member

josaphatim commented Jan 25, 2024

@Shadow243

I think there are two configurations that are different. Try to read code below.

This config was used when auth_type was set to LDAP
https://github.com/cypht-org/cypht/blob/1.4.x/hm3.sample.ini#L58

This config file has sections, for each LDAP backend you want to support
https://github.com/cypht-org/cypht/blob/1.4.x/modules/ldap_contacts/ldap.ini#L11

@Shadow243 Shadow243 force-pushed the ldap-contact-error-with-php82 branch from 81eb854 to 44f08a3 Compare January 29, 2024 00:01
@Shadow243
Copy link
Member Author

@josaphatim

You are right, I updated.

@Shadow243

I think there are two configurations that are different. Try to read code below.

This config was used when auth_type was set to LDAP https://github.com/cypht-org/cypht/blob/1.4.x/hm3.sample.ini#L58

This config file has sections, for each LDAP backend you want to support https://github.com/cypht-org/cypht/blob/1.4.x/modules/ldap_contacts/ldap.ini#L11

@Shadow243 Shadow243 force-pushed the ldap-contact-error-with-php82 branch from 44f08a3 to 8a8a3e5 Compare January 30, 2024 21:50
@kroky kroky merged commit 4c1f6a6 into cypht-org:master Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants