hydrian / TTRSS-Auth-LDAP

GitHub repository for Tiny Tiny RSS's auth_ldap plugin
https://github.com/hydrian/TTRSS-Auth-LDAP/wiki
Other
28 stars 21 forks source link

PDOException on 5a35b31 with PHP7.2 #31

Open Science4583 opened 6 years ago

Science4583 commented 6 years ago

Hello,

I'm running into this error on a brand new setup. It passes the login screen but then just sits at a blank page.

Uncaught PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "" in /var/www/ttrss/classes/logger/sql.php:21 Stack trace: #0 /var/www/ttrss/classes/logger/sql.php(21): PDOStatement->execute(Array) #1 /var/www/ttrss/classes/logger.php(28): Logger_SQL->log_error(1024, 'Array\n(\n [ho...', '', '', '') #2 /var/www/ttrss/plugins.local/auth_ldap/init.php(84): Logger->log_error(1024, 'Array\n(\n [ho...', '', '', '') #3 /var/www/ttrss/plugins.local/auth_ldap/init.php(284): Auth_Ldap->_log('Array\n(\n [ho...', 1024) #4 /var/www/ttrss/include/functions.php(706): Auth_Ldap->authenticate('testuser', '12345') #5 /var/www/ttrss/classes/handler/public.php(481): authenticate_user('testuser', '12345') #6 /var/www/ttrss/public.php(50): Handler_Public->login() #7 {main} thrown

hydrian commented 6 years ago

Looks like an error in the logging system not Auth-LDAP. Auth-LDAP doesn't use PDO for anything. Please at switch to log logging type and see if that error continues. File or syslog are good candidates.

If it doesn't, it is a logging issue and you should update the core. It the exception continues, I'll take a look into it.

chrbayer commented 6 years ago

I have the same issue, looks like commit 01d22e255f7a026bb0b0324cde1d8a8756c84a20 in the tt-rss repository leads to this problem:

-       $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+       $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

But I can't say what the root cause problem is... Now some problem is not a simple warning but an exception which stops tt-rss from working...

hydrian commented 6 years ago

Did either of you try switching to non-sql logging? See if that works.

chrbayer commented 6 years ago

I will try to change the log method, but something is really wrong with the logging, this should work even with sql logging...

PDOStatement::execute(): SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: ""
1. classes/logger/sql.php(21): execute(Array)
2. classes/logger.php(28): log_error(1024, User: admin authentication successful, , , )
3. plugins.local/auth_ldap/init.php(89): log_error(1024, User: admin authentication successful, , , )
4. plugins.local/auth_ldap/init.php(323): _log(User: admin authentication successful)
5. include/functions.php(706): authenticate(admin, XXX)
6. classes/handler/public.php(481): authenticate_user(admin, XXX)
7. public.php(50): login()
chrbayer commented 6 years ago

With both other logging methods it works...

hydrian commented 6 years ago

I haven't changed the logging messages in years, so something changed upstream. It has to be determined if this is a bug from upstream or a change of logging requirements.

hydrian commented 6 years ago

@chrbayer It sounds like a bug. If it was a change of requirements, it would have probably still had an issue.

I'll see what I can find upstream.

Science4583 commented 6 years ago

I posted this mainly because I haven't gotten the LDAP auth to work right yet. I noticed that the error logging was broken before my pull and even more broken after. I haven't spent much time digging into it due to other priorities, but switching the logging to syslog works fine for getting the errors.

hydrian commented 6 years ago

@mbazdell, Looks like there is some code rot. I'll look into cleaning it up. As a temporary workaround, if you can change your logging type file or syslog and not hit this error.