#38394 [Opn->Csd]: PDO inconsistency on some warnings
| From: | iliaa@php.net | Date: | Wed, 09 Aug 2006 14:46:41 +0000 |
| Subject: | #38394 [Opn->Csd]: PDO inconsistency on some warnings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100599@lists.php.net to get a copy of this message | ||
ID: 38394
Updated by: iliaa@php.net
Reported By: stochnagara at hotmail dot com
-Status: Open
+Status: Closed
Bug Type: PDO related
Operating System: windows xp
PHP Version: 5.2.0RC1
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-08-09 07:52:31] stochnagara at hotmail dot com
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 this bug report at http://bugs.php.net/?id=38394&edit=1