ID: 37925
User updated by: batataw at gmail dot com
Reported By: batataw at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Output Control
Operating System: Linux Fedora
PHP Version: 5.1.4
New Comment:
<?
public function insertUser($user){
//call the stored procedure
$sql = "CALL
user_insert(@userId,:username,:passwd,:firstname,:lastname,:email,:web,:country,:language,:gender,:city,:dob,:initial,:avatar,:servicelevelId);";
//Prepare request
try{
$sth = $this->db->prepare($sql);
}
catch(PDOException $e){
$errmsg = implode(":",$sth->errorInfo());
Error::userErrorHandler(E_USER_WARNING, $errmsg,
__FILE__, __LINE__,
DRM_ERROR_DB_CALL);
}
$sth->bindParam(":username",
$user["username"],PDO::PARAM_STR);
$sth->bindParam(":passwd",
$user["passwd"],PDO::PARAM_STR);
$sth->bindParam(":firstname",
$user["firstname"],PDO::PARAM_STR);
$sth->bindParam(":lastname",
$user["lastname"],PDO::PARAM_STR);
//Execute Request
try{
$sth->execute();
}
catch(PDOException $e){
$errmsg = implode(":",$sth->errorInfo());
Error::userErrorHandler(E_USER_WARNING, 'DB Error : '.
$errmsg,
__FILE__, __LINE__, $errmsg); echo "Error Message";
exit;
}
}
?>
Previous Comments:
------------------------------------------------------------------------
[2006-06-27 11:25:37] [EMAIL PROTECTED]
I don't think I have $sth and Error::userErrorHandler() method. That's
why I asked for short but COMPLETE reproduce script.
------------------------------------------------------------------------
[2006-06-27 11:18:58] batataw at gmail dot com
<?
try{
$sth->execute();
}
catch(PDOException $e){
$errmsg = implode(":",$sth->errorInfo());
Error::userErrorHandler(E_USER_WARNING, 'DB Error : '. $errmsg,
__FILE__, __LINE__, $errmsg);
echo "Message Error";
exit;
}
?>
------------------------------------------------------------------------
[2006-06-27 11:14:45] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-06-27 11:05:14] batataw at gmail dot com
Description:
------------
After a Try/Catch block I used an exit. It's impossible to display all
the echos (print, var_dump...) between the Try/Catch block and the
exit.
I had to use these functions to force the echo :
$buffer = ob_get_flush();//hack
flush();
exit;
Reproduce code:
---------------
//Execute Request
try{
$sth->execute();
}
catch(PDOException $e){
$errmsg = implode(":",$sth->errorInfo());
Error::userErrorHandler(E_USER_WARNING, 'DB Error : '. $errmsg,
__FILE__, __LINE__, $errmsg);
}
------------------------------------
echo "Message Error";
exit;
Expected result:
----------------
Message Error
Actual result:
--------------
Nothing
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37925&edit=1