Bug #52104 [NEW]: bindColumn creates Warning regardless of ATTR_ERRMODE settings
| From: | daniel dot baulig at gmx dot de | Date: | Wed, 16 Jun 2010 20:47:17 +0000 |
| Subject: | Bug #52104 [NEW]: bindColumn creates Warning regardless of ATTR_ERRMODE settings | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-151550@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 7 / Debian
PHP version: 5.3.2
Package: PDO related
Bug Type: Bug
Bug description:bindColumn creates Warning regardless of ATTR_ERRMODE settings
Description:
------------
If you call bindColumn on a non existent column it will always create a
warning, no matter how the PDO object is configured to respond to errors
(ERRMODE_EXCEPTION, ERRMODE_SILENT, ERRMODE_WARNING).
I actually recreated this on PHP 5.3.1 and PHP 5.2.6-1+lenny8 (from Debian
Lenny repository) and have NOT tried it on 5.3.2. Since I was not able to
find any references for this bug on the web, I believe I might be the first
one to encounter it and it is propably not fixed as of PHP 5.3.2
Test script:
---------------
$pdo = new PDO('mysql:host=localhost;dbname=db', 'root', '');
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$statement = $pdo->prepare('SELECT id FROM aTable');
$statement->execute();
$field= NULL;
try
{
$statement->bindColumn('none_existent_field', $field, PDO::PARAM_INT);
while ($statement->fetch( PDO::FETCH_BOUND ))
{
echo $field. "<br/>\n";
}
}
catch (PDOException $e)
{
echo "Database field not in result set!<br/>\n";
}
Expected result:
----------------
The string "Database field not in result set!<br/>\n";
Actual result:
--------------
A warning:
<b>Warning</b>: PDOStatement::bindColumn() [<a
href='pdostatement.bindcolumn'>pdostatement.bindcolumn</a>]: Did not found
column name 'none_existent_field' in the defined columns; it will not be
bound in <b>/path/to/script.php</b> on line <b>10</b><br />
--
Edit bug report at http://bugs.php.net/bug.php?id=52104&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52104&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52104&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52104&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52104&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52104&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52104&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52104&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52104&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52104&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52104&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52104&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52104&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52104&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52104&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52104&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52104&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52104&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52104&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52104&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52104&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52104&r=mysqlcfg