From: selecter at gmail dot com
Operating system: Gentoo Linux x86_64
PHP version: 4CVS-2006-08-22 (snap)
PHP Bug Type: PDO related
Bug description: vardump($einfo = $pdo->errorInfo()) causes php to crash
Description:
------------
The code below leads to unclear error Fatal error: : in
/var/www/localhost/htdocs/crash.php on line 33
But if I pass int values instead of bool, this code works fine.
Instead of:
'show_email' => (bool) 1,
'show_smiles' => (bool) 1,
Write:
'show_email' => 1,
'show_smiles' => 1,
I noticed that because I get those values like this:
'show_email' => CheckBox::isOn('show_email'),
'show_smiles' => CheckBox::isOn('show_smiles'),
which return bool values...
Reproduce code:
---------------
<?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' => (bool) 1,
'show_smiles' => (bool) 1,
'timezone_offset' => 0,
'messages_on_page' => 5,
'uid', 6
);
$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);
$id = 6;
$st->bindParam(5, $id, 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';
}
?>
--
Edit bug report at http://bugs.php.net/?id=38546&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38546&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38546&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38546&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38546&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38546&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38546&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38546&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38546&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38546&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38546&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38546&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38546&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38546&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38546&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38546&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38546&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38546&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38546&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38546&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38546&r=mysqlcfg