PDOException on login in DB_Table.php

15 views
Skip to first unread message

Aaron Peachey

unread,
Jul 26, 2015, 4:33:42 AM7/26/15
to uFlex
Hi,

Having an issue at login stage, when a user logs in successfully the following exception is thrown - it appears to be happening when trying to update the last login details in the database. 

PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in /var/www/lib/vendor/ptejada/uflex/src/DB_Table.php:199\nStack trace:\n#0 /var/www/lib/vendor/ptejada/uflex/src/DB_Table.php(199): PDOStatement->fetchAll()\n#1 /var/www/lib/vendor/ptejada/uflex/src/User.php(295): ptejada\\uFlex\\DB_Table->runQuery('UPDATE _table_ ...', Array)\n#2 /var/www/lib/vendor/ptejada/uflex/src/User.php(211): ptejada\\uFlex\\User->logLogin()\n#3 /var/www/lib/vendor/ptejada/uflex/src/User.php(279): ptejada\\uFlex\\User->login()\n#4 /var/www/includes/user_manage.php(9): ptejada\\uFlex\\User->start()\n#5 /var/www/html/admin.php(3): require_once('/var/www/includ...')\n#6 {main}\n  thrown in /var/www/lib/vendor/ptejada/uflex/src/DB_Table.php on line 199...



I've traced that to line 199 in DB_Table.php which seems to be incorrectly running a fetchAll() statement on a PDO update query...

$rows = ($rows > 0) ? $rows : count($stmt->fetchAll());

Anyone else having this issue?

thanks
Aaron




Pablo

unread,
Jul 26, 2015, 1:04:24 PM7/26/15
to uFlex, alpe...@gmail.com, alpe...@gmail.com
Hey Aaron,

Please surround your code with try/catch block and in the catch block do a print_r($user->log->getFullConsole()) and provide me with the output.

Thank you,

Aaron Peachey

unread,
Jul 31, 2015, 8:10:21 PM7/31/15
to uFlex, alpe...@gmail.com
Thanks for the reply. 
Note I have fixed the issue by surrounding line 199 in DB_Table.php with a try-catch block and when I catch PDOException I simply set $rows = 0.

However, I've done what you asked too so you can debug if you like. Here's the output:

Array
(
   
[errors] => Array
       
(
           
[User::login] => Array
               
(
               
)


       
)


   
[reports] => Array
       
(
           
[User::_main] => Array
               
(
                   
[0] => >> New _main request
                   
[1] => Session is been started...
               
)


           
[User::login] => Array
               
(
                   
[0] => >> New login request
                   
[1] => Attempting Login with cookies
                   
[2] => Querying Database to authenticate user
                   
[3] => SQL Statement: SELECT * FROM Users  WHERE ID=:ID LIMIT 1
                   
[4] => SQL Data Sent: [2]
                   
[5] => SQL Statement: UPDATE Users  SET LastLogin=:stamp WHERE ID=:id
                   
[6] => SQL Data Sent: [1438166818, 2]
               
)


       
)


   
[form] => Array
       
(
           
[User::login] => Array
               
(
               
)


       
)


)

Pablo Tejada

unread,
Aug 1, 2015, 12:45:40 AM8/1/15
to uFlex, alpe...@gmail.com

This is so wierd, can you provide a stack trace of caught PDO exception?


--
Project's home page http://ptejada.com/projects/uFlex/
---
You received this message because you are subscribed to the Google Groups "uFlex" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uflex+un...@googlegroups.com.
To post to this group, send email to uf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uflex/d8413b33-5e87-4a21-9666-b72e9dabcac1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Sincerely,

Pablo Tejada

From Mobile

Reply all
Reply to author
Forward
0 new messages