|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-06-01 06:50 UTC] kadovat at gmail dot com
Description:
------------
PDO doesn't throw an exception when occurs mysql error 1690:bigint unsigned value is out of rangeļ¼just return an empty array
Test script:
---------------
# CREATE TABLE `test` (`id` int(10) unsigned DEFAULT NULL, `pv` int(10) unsigned DEFAULT NULL,`yesterday_pv` int(10) unsigned DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8
#insert into test set id=1,pv=1,yesterday_pv=2;
<?php
$dbh = new PDO("mysql:host=localhost;port=3306;dbname=testdb","root");
$sth = $dbh->prepare('select id,pv-yesterday_pv from test');
$sth->execute();
$result = $sth->fetchAll();
var_dump($result);
Expected result:
----------------
throw a PDOException
Actual result:
--------------
array(0) {
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 11:00:02 2025 UTC |
If you want PDO to throw exceptions, you have to tell it to: $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);