#38520 [Fbk->Opn]: vardump($einfo = $pdo->errorInfo()) causes php to crash
| From: | selecter at gmail dot com | Date: | Sun, 20 Aug 2006 17:00:50 +0000 |
| Subject: | #38520 [Fbk->Opn]: vardump($einfo = $pdo->errorInfo()) causes php to crash | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100996@lists.php.net to get a copy of this message | ||
ID: 38520
User updated by: selecter at gmail dot com
Reported By: selecter at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Reproducible crash
Operating System: Linux Gentoo 2006.0
-PHP Version: 5.1.5
+PHP Version: 5.1.4
New Comment:
Worked fine on latest snapshot.
Previous Comments:
------------------------------------------------------------------------
[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);
}
?>
------------------------------------------------------------------------
[2006-08-20 14:21:33] selecter at gmail dot com
I also run x86_64 if it helps
------------------------------------------------------------------------
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