[PHP-BUG] Bug #51596 [NEW]: Exception when creating database with PDO

[email protected] ("foo-script at o2 dot pl")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             
Operating system: Windows XP SP3
PHP version:      5.3.2
Package:          PDO related
Bug Type:         Bug
Bug description:Exception when creating database with PDO

Description:
------------
A "test script" produced following exception:

exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in
L:\Program Files\Apache Software Foundation\Apache2.2\htdocs\readme.php:44
Stack trace: #0 L:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\readme.php(44): unknown() #1 {main}

However, database have been successfuly created.

Test script:
---------------
try{
	$pdo=new PDO('mysql:host='.$dbHost.';'.'dbname=mysql;'.'port='.$port,
'root', $dbKey, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES
\'UTF8\''));

	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$result=$pdo->query('CREATE DATABASE test;'); }

Expected result:
----------------
In my opinion exception should not be thrown, cause effect is good.


-- 
Edit bug report at http://bugs.php.net/bug.php?id=51596&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51596&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51596&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51596&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51596&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51596&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51596&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51596&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51596&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51596&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51596&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51596&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51596&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51596&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51596&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51596&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51596&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51596&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51596&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51596&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51596&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51596&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.