Edit report at http://bugs.php.net/bug.php?id=53970&edit=1

 ID:                 53970
 Comment by:         lopez at freshsite dot de
 Reported by:        lopez at freshsite dot de
 Summary:            PDOStatement::execute returns TRUE even when sql
                     statement is not executed
 Status:             Open
 Type:               Bug
 Package:            PDO related
 Operating System:   Windows
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

I recognized, that the error was different, but the expected result is
same.



The sql statement tried to insert a too long string (6 chars) into a too
small field => varchar(2).



However, the execute function should return FALSE, but it doesn't !


Previous Comments:
------------------------------------------------------------------------
[2011-02-09 12:04:13] lopez at freshsite dot de

Description:
------------
I recognized, that the return value stay TRUE, even if the sql statement
could not be executed correctly.

Test script:
---------------
Example:

$sth = $this->db->prepare("REPLACE INTO test

                                                                    SET bar = 
:foo);

$error = $sth->execute(array('foo' => 'bar'));



/*

$error will be TRUE, because sql is correct and sent.



However, if the mysql user has not the rights (INSERT,DELETE) to do
this, the statement will be not executed at all without error message.



So, don't rely on the returning value until this is fixed!

Expected result:
----------------
$error should be FALSE

Actual result:
--------------
$error is TRUE


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53970&edit=1

Reply via email to