Bug 264672 - net/phpldapadmin: Fatal error: Uncaught Error: Undefined constant "LDAP_DEREF_NEVER"
Summary: net/phpldapadmin: Fatal error: Uncaught Error: Undefined constant "LDAP_DEREF...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
: 265135 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-06-14 20:31 UTC by Gerard Seibert
Modified: 2022-12-17 10:50 UTC (History)
4 users (show)

See Also:
ports: maintainer-feedback+


Attachments
Output from phpinfo() (25.89 KB, text/plain)
2022-06-15 09:46 UTC, Gerard Seibert
no flags Details
Output from the htdoc directory: php index.php (5.86 KB, text/plain)
2022-06-15 18:29 UTC, Gerard Seibert
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerard Seibert 2022-06-14 20:31:21 UTC
FreeBSD 13-1 RELEASE with PHP81

When attempting to start phpldapadmin, I am greeted with this FATAL ERROR message:

Fatal error: Uncaught Error: Undefined constant "LDAP_DEREF_NEVER" in /usr/local/www/phpldapadmin/lib/config_default.php:387 Stack trace: #0 /usr/local/www/phpldapadmin/lib/functions.php(264): Config->__construct() #1 /usr/local/www/phpldapadmin/htdocs/index.php(116): check_config('/usr/local/www/...') #2 {main} thrown in /usr/local/www/phpldapadmin/lib/config_default.php on line 387
Comment 1 Krzysztof 2022-06-15 06:03:18 UTC
According to documentation (https://www.php.net/manual/en/ldap.constants.php) such errors suppose that php-ldap is not installed on system. php81 changed it's beahavior about modules?

Are you running PLA with nginx/php-fpm? If yes you have to restart php-fpm to load new installed modules
Comment 2 Gerard Seibert 2022-06-15 09:13:28 UTC
(In reply to Krzysztof from comment #1)

apache24 with the following php ports installed:

mod_php81-8.1.7                PHP Scripting Language (8.1.X branch)
php81-8.1.7                    PHP Scripting Language (8.1.X branch)
php81-bz2-8.1.7                The bz2 shared extension for php
php81-ctype-8.1.7              The ctype shared extension for php
php81-filter-8.1.7             The filter shared extension for php
php81-gd-8.1.7                 The gd shared extension for php
php81-gettext-8.1.7            The gettext shared extension for php
php81-iconv-8.1.7              The iconv shared extension for php
php81-ldap-8.1.7               The ldap shared extension for php
php81-mbstring-8.1.7           The mbstring shared extension for php
php81-mysqli-8.1.7             The mysqli shared extension for php
php81-session-8.1.7            The session shared extension for php
php81-xml-8.1.7                The xml shared extension for php
php81-xmlwriter-8.1.7          The xmlwriter shared extension for php
php81-zip-8.1.7                The zip shared extension for php
php81-zlib-8.1.7               The zlib shared extension for php
phpMyAdmin5-php81-5.2.0        Set of PHP-scripts to manage MySQL over the web
phpldapadmin-php81-1.2.6.3_1   PHP application to administer LDAP over the web
suphp-php81-0.7.2_2            Securely execute PHP scripts under Apache
Comment 3 Krzysztof 2022-06-15 09:22:42 UTC
(In reply to Gerard Seibert from comment #2)

$ php -m | grep ldap should return ldap

try to run phpinfo() and see that ldap module is "activated" in mod_php

If both checks will return succes it means that I have to check and consult with PLA developer what could be a problem.
Comment 4 Gerard Seibert 2022-06-15 09:46:28 UTC
Created attachment 234698 [details]
Output from phpinfo()

Complete output from the phpinfo() function
Comment 5 Krzysztof 2022-06-15 12:26:08 UTC
cd /usr/local/www/phpldapadmin/htdocs
php index.php

and the result is...
Comment 6 Gerard Seibert 2022-06-15 18:29:48 UTC
Created attachment 234708 [details]
Output from the htdoc directory:  php index.php
Comment 7 Gerard Seibert 2022-06-15 18:36:03 UTC
I removed and reinstalled phpldapadmin and php81. Now, phpldapadmin starts (sort of), but it issues error messages, and I cannot log in.

View the two screenshots attached here and tell me what you think. The titles are pretty much self-explanatory. The second screen appears when I try to log in.

https://seibercom.net/images/OpeningScreen.png

https://seibercom.net/images/SecondScreen.png

I don't know 'php', so there isn't much I can do to debug this phenomenon. Under FreeBSD 11.4, I never had any problems at all.
Comment 8 Krzysztof 2022-06-15 19:20:59 UTC
So... 

It is very difficult to write php apps and follow everything that is changing between php versions (ie. 7.x, 8.x).

Very quick searching with Google shows that's common problem with trim function.

So it seems that PLA is not compatible with php 8.1+ (for now).
Comment 9 Krzysztof 2022-06-15 19:27:58 UTC
Pleas check it: https://github.com/leenooks/phpLDAPadmin/pull/149
Comment 10 Gerard Seibert 2022-06-15 19:41:41 UTC
(In reply to Krzysztof from comment #8)
It doesn't work with php-8.0 either. I guess I will have to find another app to handle my needs. There is no way I am downgrading to 7.4
Comment 11 Krzysztof 2022-06-15 19:49:23 UTC
(In reply to Gerard Seibert from comment #10)

No. I've made some patches (a month ago?), so I can confirm that with php80 it works. I've migrated a few servers to php80 and PLA is working very good.

Telling the truth I'm using nginx+ pgp-fpm, but maybe there is problem with php settings...
Comment 12 Gerard Seibert 2022-06-15 20:17:26 UTC
(In reply to Krzysztof from comment #11)
I can confirm that it does not work with apache24 on a FreeBSD 13.1 system with either php81 0r php80. It works fine on FreeBSD 11.4 with php74.

I know virtually nothing about PHP so I cannot really be of any assistance to you.
Comment 13 Krzysztof 2022-06-15 21:32:56 UTC
OK. So I suggest to close this bug as we know why PLA is not working.
Comment 14 Gerard Seibert 2022-06-15 21:38:47 UTC
(In reply to Krzysztof from comment #13)
Might I suggest that you put some sort of notification that phpldapadmin does not work under php80 or php81 with apache24 so that potential users will not waste their time attempting to install it? Better yet, just pull the port until you have had time to correct and properly test the port before reissuing it.

In any case, I would like to be kept informed if and when the port is actually serviceable.
Comment 15 Fernando Apesteguía freebsd_committer freebsd_triage 2022-07-12 05:55:47 UTC
*** Bug 265135 has been marked as a duplicate of this bug. ***
Comment 16 Krzysztof 2022-09-19 09:09:44 UTC
OK. So I;ve made additional patches which support php81+ These additional potches should be implemented after patches which exist in files/ subdir now - some of files should be patched twice.

Because these patches should be added only for php81+, so I will be very happy is someone will help how to modify Makefile.

I've found https://docs.freebsd.org/en/books/porters-handbook/slow-porting/#slow-patch which suggests how to add extra patches in case of option. But I'm not sure how to implement these patches only for php81 and php82.

Thanks a lot for any suggestions and help
Comment 17 Krzysztof 2022-09-28 13:55:24 UTC
Please close this bug. I've made a new one with patch (bug#266678).
Comment 18 Gerard Seibert 2022-10-15 12:55:39 UTC
(In reply to Krzysztof from comment #17)
I will be thrilled to close this bug report once the port is updated with your patch, and I can install and test it myself.
Comment 19 Krzysztof 2022-10-15 17:31:39 UTC
(In reply to Gerard Seibert from comment #18)
This PR (bug report) is blocker for commit of changes. I will check if it is possible to remove "blocker" from new bug report.
Comment 20 Krzysztof 2022-10-15 17:35:51 UTC
(In reply to Krzysztof from comment #19)
OK, so bug #266678 is changed and it does not depend on this bug report. I hope that patch will be commited soon and you will be able to work with PLA and php81.

As I wrote earlier (or on private message) it was tested with php82 also and there was no problems reported.
Comment 21 Krzysztof 2022-11-10 13:56:50 UTC
This bug maybe closed because bug#266678 is awaiting for commit to ports tree. And bu#266678 cantains solution for this one.
Comment 22 Ronald Klop freebsd_committer freebsd_triage 2022-12-01 10:04:42 UTC
A patch to bug #266678 is committed. Please verify that it fixes your issue and report back so I can close this issue.
Comment 23 Krzysztof 2022-12-05 10:04:10 UTC
(In reply to Ronald Klop from comment #22)
Well, bug#266678 was updated because I missed some fixes. But there is new bug#268135 which shows my mistake. I think one of these bugs should be closed as "duplicated"?

I hope new patch from bug#266678 will be committed so all three bugs will be closed :-)))
Comment 24 commit-hook freebsd_committer freebsd_triage 2022-12-12 10:37:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=05adb0bbb787e824fd84aa7aed170182a55268e7

commit 05adb0bbb787e824fd84aa7aed170182a55268e7
Author:     Krzysztof <ports@bsdserwis.com>
AuthorDate: 2022-12-08 09:23:03 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2022-12-12 10:36:10 +0000

    net/phpldapadmin: additional fix to support for php81+

    PR:     266678 268135 264672
    Approved by: rene (mentor)
    Differential Revision: https://reviews.freebsd.org/D37633

 net/phpldapadmin/Makefile                          |  2 +-
 .../files/patch-lib_AttributeFactory.php           |  7 ++++-
 net/phpldapadmin/files/patch-lib_PageRender.php    | 29 ++++++++++++++++++
 net/phpldapadmin/files/patch-lib_Tree.php          |  9 ++++++
 net/phpldapadmin/files/patch-lib_common.php        | 11 +++++++
 net/phpldapadmin/files/patch-lib_ds__ldap.php      | 35 ++++++++++++++++++++--
 net/phpldapadmin/files/patch-lib_ds__ldap__pla.php | 27 +++++++++++++++++
 net/phpldapadmin/files/patch-lib_functions.php     | 29 ++++++++++++++++++
 net/phpldapadmin/files/patch-lib_xmlTemplates.php  |  9 ++++++
 9 files changed, 154 insertions(+), 4 deletions(-)
Comment 25 Ronald Klop freebsd_committer freebsd_triage 2022-12-12 15:16:18 UTC
And can you also confirm if this is fixed by the latest commit to bug #266678?
Comment 26 Krzysztof 2022-12-13 21:18:14 UTC
I suggest to close this bug as bug#268349 will be committed.
Comment 27 Ronald Klop freebsd_committer freebsd_triage 2022-12-17 10:50:45 UTC
bug #268349 is committed