ID: 38520
Updated by: iliaa@php.net
Reported By: selecter at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Reproducible crash
Operating System: Linux Gentoo 2006.0
PHP Version: 5.1.4
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-20 17:00:49] selecter at gmail dot com
Worked fine on latest snapshot.
------------------------------------------------------------------------
[2006-08-20 14:45:54] pajoye@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2006-08-20 14:42:53] selecter at gmail dot com
No crash if to delete bindParam lines and pass $prefs to execute()
if(($num=$st->execute($prefs)) === FALSE){
But: "Fatal error: : in /var/www/localhost/htdocs/crash.php on line 23"
which gives me no idea what was wrong in my query.
------------------------------------------------------------------------
[2006-08-20 14:40:25] selecter at gmail dot com
Sorry... This is more likely you want:
<?php
try{
$dsn = 'mysql:host=localhost;dbname=test';
$db = new PDO($dsn, 'root', 'pass');
}catch(PDOException $e){
trigger_error($e->getMessage(), E_USER_ERROR);
}
$prefs = array(
'show_email' => 0,
'show_smiles' => 1,
'timezone_offset' => 0,
'messages_on_page' => 5
);
$st = $db->prepare("UPDATE preferences SET show_email=?,
show_smiles=?, timezone_offset=?, messages_on_page=? WHERE uid=?");
$st->bindParam(1, $prefs['show_email'], PDO::PARAM_BOOL);
$st->bindParam(2, $prefs['show_smiles'], PDO::PARAM_BOOL);
$st->bindParam(3, $prefs['timezone_offset'], PDO::PARAM_INT);
$st->bindParam(4, $prefs['messages_on_page'], PDO::PARAM_INT);
$st->bindParam(5, 6, PDO::PARAM_INT);
if(($num=$st->execute()) === FALSE){
$einfo = $db->errorInfo();
$einfo = $db->errorCode.': '.$einfo[2];
?><pre><?php
debug_print_backtrace();
?></pre><?php
trigger_error($einfo, E_USER_ERROR);
}else{
echo 'ok';
}
?>
------------------------------------------------------------------------
[2006-08-20 14:34:28] selecter at gmail dot com
Here's the code that crashes:
<?php
try{
$dsn = 'mysql:host=localhost;dbname=test';
$db = new PDO($dsn, 'root', 'pass', array(PDO_ATTR_PERSISTENT =>
1));
}catch(PDOException $e){
trigger_error($e->getMessage(), E_USER_ERROR);
}
$prefs = array(
'show_email' => 0,
'show_smiles' => 1,
'timezone_offset' => 0,
'messages_on_page' => 5
);
$st = $db->prepare("UPDATE preferences SET show_email=?,
show_smiles=?, timezone_offset=?, messages_on_page=? WHERE uid=?");
$st->bindParam(1, $prefs['show_email'], PDO::PARAM_BOOL);
$st->bindParam(2, $prefs['show_smiles'], PDO::PARAM_BOOL);
$st->bindParam(3, $prefs['timezone_offset'], PDO::PARAM_INT);
$st->bindParam(4, $prefs['messages_on_page'], PDO::PARAM_INT);
$st->bindParam(5, 6, PDO::PARAM_INT);
if(($num=$st->execute()) === FALSE){
$einfo = $ptr->errorInfo();
$einfo = $ptr->errorCode.': '.$einfo[2];
?><pre><?php
debug_print_backtrace();
?></pre><?php
trigger_error($einfo, E_USER_ERROR);
}else{
$this->session->cacheUserPrefs($prefs);
}
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/38520
--
Edit this bug report at http://bugs.php.net/?id=38520&edit=1