philbertphotos / osticket-multildap-auth-plugin

Plugin for OS Ticket that allows for authentication with multiple domains.
GNU General Public License v3.0
28 stars 17 forks source link

PHP Fatal error: Non-static method cannot be called statically #51

Closed dylanglass6300 closed 2 years ago

dylanglass6300 commented 2 years ago

osTicket - v1.16.2 PHP - 8.0.18 Apache - 2.4.53

I've added the plugin, and it shows in my list of currently installed plugins. When I click on the name to configure it, the options area is empty, pictured below:

image

In my apache error log, the error I am getting is:

[Thu May 05 14:15:06.025931 2022] [php:error] [pid 772:tid 1872] [client ::1:55923] PHP Fatal error: Uncaught Error: Non-static method LdapMultiAuthPlugin::DateFromTimezone() cannot be called statically in C:\xampp\htdocs\osticket\include\plugins\multi-ldap\config.php:28\nStack trace:\n#0 C:\xampp\htdocs\osticket\include\plugins\multi-ldap\config.php(278): LdapMultiAuthPluginConfig->getschedule()\n#1 C:\xampp\htdocs\osticket\include\class.plugin.php(12): LdapMultiAuthPluginConfig->getOptions()\n#2 C:\xampp\htdocs\osticket\include\class.plugin.php(485): PluginConfig->__construct('9')\n#3 C:\xampp\htdocs\osticket\include\staff\plugin.inc.php(5): Plugin->getConfig()\n#4 C:\xampp\htdocs\osticket\scp\plugins.php(66): require('C:\\xampp\\htdocs...')\n#5 {main}\n thrown in C:\xampp\htdocs\osticket\include\plugins\multi-ldap\config.php on line 28, referer: http://localhost/osticket/scp/plugins.php

e-p-s commented 2 years ago

/var/log/apache2/error.log ` PHP Warning: Module "imap" is already loaded in Unknown on line 0 PHP Warning: Module "ldap" is already loaded in Unknown on line 0 PHP Warning: Module "mbstring" is already loaded in Unknown on line 0 [Tue May 31 13:56:44.161818 2022] [mpm_prefork:notice] [pid 583] AH00163: Apache/2.4.53 (Debian) configured -- resuming normal operations [Tue May 31 13:56:44.161941 2022] [core:notice] [pid 583] AH00094: Command line: '/usr/sbin/apache2' [Tue May 31 13:58:05.504699 2022] [php:error] [pid 655] [client 172.21.61.190:53471] PHP Fatal error: Cannot make static method LDAPMultiAuthentication::getconfig() non static in class SyncLDAPMultiClass in /var/www/html/scp/sync_mldap> [Tue May 31 13:59:37.371670 2022] [php:error] [pid 654] [client 172.21.61.190:53572] PHP Fatal error: Cannot make static method LDAPMultiAuthentication::getconfig() non static in class SyncLDAPMultiClass in /var/www/html/scp/sync_mldap> [Tue May 31 14:27:24.676075 2022] [php:error] [pid 657] [client 172.21.61.190:55030] PHP Fatal error: Cannot make static method LDAPMultiAuthentication::getconfig() non static in class SyncLDAPMultiClass in /var/www/html/scp/sync_mldap>

/var/log/php8.0-fpm.log [31-May-2022 13:56:44] NOTICE: fpm is running, pid 498 [31-May-2022 13:56:44] NOTICE: ready to handle connections [31-May-2022 13:56:44] NOTICE: systemd monitor interval set to 10000ms

PHP 8.0.18 (cli) (built: Apr 21 2022 10:49:51) ( NTS ) Server version: Apache/2.4.53 (Debian) Server built: 2022-03-14T16:28:35

osticket 1.16.2 - update to 1.16.3 ?

PaysenPetersen commented 2 years ago

Hello, everyone,

In the past few days we have intensively dealt with with the various problems. Since we have a German version of Osticket with a German Windoes Server, there are several problems that we could solve some. I only say date format and spaces and umlauts.

  1. In the sync_mldapp.php we had to adjust the function of change time because of the German date format.

line 2 - ...

`` if ($_REQUEST['sync'] || $_REQUEST['check']){ //Load Osticket environment file_exists('../main.inc.php') or die('System Error'); if (!defined('DISABLE_SESSION')) define('DISABLE_SESSION', true);

require_once('../main.inc.php');

} ``

and

Line 202 !?

` function changetime($when) {

    $ndt =  date_create_from_format('Ymdhis.0Z', $when);
    if(is_bool($ndt)) {
        trigger_error("DATE and/or TIME is invalid");
        return "2000-01-01 12:00:00";
    }

    $time = date_format($ndt, "Y-m-d H:i:s");

    return $time;

`

  1. The Search user must be there urgently because the library used needs a user. The LDAP user requires at least reading right in the LDAP server. This can be set via the ADSI.

Attention: We have a spaces in the OU in which the LDAP search user was created. After we moved him to the users OU, the search worked.

  1. After these changes, 2 domains can now register with your user name and password. However, I still have the problem that customers are still not being imported. And if a new customer creates a ticket, the user fields will not be syncralized. If you still have an idea for this, I would be very grateful to you.

image

philbertphotos commented 2 years ago

@e-p-s I can fix this problem ...let me see if I can duplicated first. Was this the latest version?

philbertphotos commented 2 years ago

@PaysenPetersen ohhhh that makes sense now. Yea yea I think I know the issue. As for a CN with spaces this is my CN and it works CN=VIDE Service Account,OU=Service Accounts,DC=local,DC=com.

If the search works then the syncing should work also since its the same (or should be but I think I know why it wont so let me comb through the code for the differences. Glad you get some of the other issue ironed out.

As for the time stuff I have no idea how to make it compatible for all time formats.

PaysenPetersen commented 2 years ago

Hello, I posted the code for the time problem at the top. Please test the code with you. I think you have an English version at the start. I installed your last version. However, the CN search with spaces does not work for me. Did you already patch? If you tested it again, I would test it again with me. Because at the moment I can't use the add on. If a non -registered user registers via the LDAP authentication, the name and the email address will not be fetched. As a result, there is an error when completing the ticket position.

If you ask the language and like it on Germany, you could largely deal with the problem. Unfortunately I have been out of programming for a long time. The adjustment had made a colleague who is currently not there.

In the screenshot you can still see 2 \ in the CN. Could that still be a problem?

In addition, I do not see any imported data record in the customer overview.

philbertphotos commented 2 years ago

@PaysenPetersen give me a few days going over the issue. Does your CN have German characters in it? You blacked it out.

philbertphotos commented 2 years ago

@PaysenPetersen Ok found the bug and was able to repeat it when a new user tries to login.

philbertphotos commented 2 years ago

Ok fixed both problems and uploading the changes tonight.

It was my fault since introduced a bug that broke the automatic user creation when fixing/enhancing other parts of the code. Never bother to check a new user from scratch.

philbertphotos commented 2 years ago

@PaysenPetersen I notice the CD you show with a space its shows "\" is that how the German characters handles spaces? Seems a bit weird/non standard. I think I fixed all the bugs and will close this issue once you confirm it works for you and the issues still pending be moved as future enhancements.

philbertphotos commented 2 years ago

Issues with PHP 8.0 and compatibility has been fixed moving issues still you be worked on a different list thanks for all of your help with the reports.