ID: 12137
Updated by: cox
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Unknown/Other Function
Operating System:
PHP Version: 4.0.6
New Comment:
That was fixed in 11th July 2001. Thanks any way.
Previous Comments:
------------------------------------------------------------------------
[2001-07-13 05:34:53] [EMAIL PROTECTED]
Multiple execution emulation fails as in the following script:
<?php
$db = DB::connect("mysql://localhost/test");
$some_query_with_params = "DELETE FROM TST WHERE id = ? ";
$params = array(1,2,3);
$stmt = $db->prepare($some_query_with_params);
foreach($params as $param)
$db->execute($stmt, array($param)); //Fails !!!
?>
The reason for that is executeEmulateQuery() code:
function executeEmulateQuery($stmt, $data = false)
{
$p = &$this->prepare_tokens;
$stmt = (int)$this->prepare_maxstmt++; // BUG ?
if (!isset($this->prepare_tokens[$stmt]) ||
!is_array($this->prepare_tokens[$stmt]) ||
!sizeof($this->prepare_tokens[$stmt])) {
return $this->raiseError(DB_ERROR_INVALID);
}
$qq = &$this->prepare_tokens[$stmt];
// and so on...
What does the second line do?:
$stmt = (int)$this->prepare_maxstmt++;
It ignores the input parameter $stmt, sets it to some unreasonable value, and we
always get DB_ERROR_INVALID. If the line is removed - everything works. Apparently
this line should not be here at all.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12137&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]