[php-src] Issue #8356: PHP 8.1 PDO (Probably a Bug) : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'school_types.type_id' in 'where clause'
in
| From: | ReturnMe | Date: | Wed, 13 Apr 2022 14:29:19 +0000 |
| Subject: | [php-src] Issue #8356: PHP 8.1 PDO (Probably a Bug) : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'school_types.type_id' in 'where clause' in |
||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240927@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8356
Comment Author: ReturnMe
> ```
> try{
> $db = new PDO('mysql:host=localhost;dbname='.DB_NAME.';charset=utf8',
> DB_USER, DB_PASS);
> }catch(PDOException $e){
> print $e->getMessage();
> }
> ```
>
> You don't enable error reporting. Please enable PDO error reporting and try again on PHP
> 7.4.
>
> Also, I would like to point out two more unrelated issues. Don't print error messages to
> the users. This exposes your database credentials and creates an attack vector. Don't use the
> deprecated
utf8 charset. Consider upgrading to
> utf8mb4
Error display is on right now as I've tested it. But I'm glad you reminded me of the
character set, I changed it :)
Yes, when I enabled reporting, it gave the same error. But before activating it was giving the rows.
For PHP 8.1, it gives the error even though error reporting is not enabled.