-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
PHP 8.1 no longer returns a resource #24
Comments
Can we please have a test case for this? |
When updating to PHP 8.1 with PHP's LDAP extension I get is not a resource error when trying to connect to LDAP |
Yes, I'm asking for a test case that runs in CI here, and that prevents this from regressions. The fact that this BC break wasn't caught, is precisely because an automated test does not cover this. |
So, how do we approach this? Or rather, what is the expected outcome? First I'd decide to either split the code base to "compatible with 8.1", and "compatible with <8.1", or make a fork in code to handle both cases. I am not sure which is better, as I am not really experienced in this field. Then, the tests. Do we cover just the connection part? Or that I'd really like to help, although I am not sure what exactly is needed. |
Are you sure that the test cases do not cover it? Looking at the test I believe that the connection test would find the problem. But looking at the action (e.g. here) I cannot see the env Seems there are two things to work on:
|
On the topic of tests: Sure enough, during my local testing, a lot of errors for PHPUnit in PHP 8.1, a lot less in PHP 8.0 (not allowing SSL, no seeded data, etc.). HOWEVER 1, it seems like the tests were available, at least according to Travis.
HOWEVER 4, the current up-to-date I think that refactoring CI overlooked LDAP tests. So, basically two things needs to be done:
As far as fixing the error goes, I am suspecting that checking if |
@Ocramius having LDAP is 8.1 is rather crucial. What can we do, how can we help? We already provided some feedback, but I can support with testing as I have automated tests that really use LDAP connections in combination with this package, but I don't feel confident enough to fix the issue here. I wonder what @Koen1999 who worked on the PHP 8.1 PR and @froschdesign who asked for the support initially think about it. |
@DerpgonCz Travis-CI is dead-dead-dead. The last CI build on So here again: provide a failing test case (FIRST), then a fix, if possible, and it will gladly be reviewed/merged. @kevinpapst if it's crucial, put dev time in it and help as described in this thread: fork the repo, get CI running with a real server, send a patch. I know as much as you do ;-) |
Check the configuration of PHPUnit: Line 46 in 5e0debb
|
What I said:
|
Honestly I don't think much about it. When I made that PR, I was trying to add PHP 8.1 support for another Laminas package that somehow required laminas-ldap even though it was optional. Since the test suite passed for the PR, I assumed this would work. I don't know much about LDAP, but if this package is blocking you I suggest you stick with PHP 8.0 for now and try to work on a fix for the issue. |
After spending 2 hours now to get the test cases up and running, I can share:
So if someone wants to join and help fixing 8.1, please post your ideas or fork my branch. |
I find that adding isset($this->$resource) works as well. For most of the code I use 'isset($this->$resource)' and check for '!== false'. In some cases, I check for isset($this->$resource) after since certain functions will instantiate the LDAP objects and will want to check if it was set after calling certain functions. |
Please no hacky workarounds: help us get the package up to date in #25! |
Releasing |
It looks like this is fixed and and can be closed. |
According to the changelog for https://www.php.net/manual/en/function.ldap-connect.php
php 8.1 no longer returns a resource for ldap_connect it now returns a class which is causing src/Ldap.php:839 to fail.
The text was updated successfully, but these errors were encountered: