#38394 [NEW]: PDO inconsistency on some warnings
| From: | stochnagara at hotmail dot com | Date: | Wed, 09 Aug 2006 07:52:31 +0000 |
| Subject: | #38394 [NEW]: PDO inconsistency on some warnings | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-100566@lists.php.net to get a copy of this message | ||
From: stochnagara at hotmail dot com
Operating system: windows xp
PHP version: 5.2.0RC1
PHP Bug Type: PDO related
Bug description: PDO inconsistency on some warnings
Description:
------------
PDO behaves strangely with some incorrect calls of 'execute'.
The first $s->execute is working as expected.
The second one does not do anything.
The third one does not do anything which is not expected.
The fourth one generates as warning as expected.
So problem 1 is that the second execute does not generate a warning and
also causes the third execute not to get executed.
If we set PDO::ATTR_ERRMODE to be PDO::ERRMODE_EXCEPTION, we
see that the second execute generates a "General error: 25 bind or column
index out of range" exception which is ok.
And if we set PDO::ATTR_ERRMODE to be PDO::ERRMODE_WARNING,
then the situation gets more and more mysterious:
Now the second execute correctly generates a warning but after that the
third one which is correct, also generates a warning which is not correct
at all.
Reproduce code:
---------------
<?
$q = new PDO ("sqlite::memory:");
//$q->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//$q->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$q->exec ("CREATE TABLE test (a,b,c)");
$s=$q->prepare ("INSERT INTO test (a,b,c) VALUES (:a,:b,:c)");
$s->execute(array ('a' => 1, 'b' => 2, 'c' => 3));
$s->execute(array ('a' => 5, 'b' => 6, 'c' => 7,
'd' => 8));
$s->execute(array ('a' => 9, 'b' => 10, 'c' => 11));
$s->execute((object)array ('a' => 1, 'b' => 2, 'c' => 3));
var_dump($q->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC));
?>
Expected result:
----------------
see description
Actual result:
--------------
see description
--
Edit bug report at http://bugs.php.net/?id=38394&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38394&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38394&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38394&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38394&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38394&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38394&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38394&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38394&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38394&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38394&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38394&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38394&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38394&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38394&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38394&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38394&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38394&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38394&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38394&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38394&r=mysqlcfg