Req #67056 [Fbk->NoF]: '...;dbname =xyz;...' unexpected behavior

From: Date: Tue, 30 Dec 2014 10:42:31 +0000
Subject: Req #67056 [Fbk->NoF]: '...;dbname =xyz;...' unexpected behavior
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189474@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67056&edit=1

 ID:               67056
 Updated by:       php-bugs@lists.php.net
 Reported by:      skvsn at ngs dot ru
 Summary:          '...;dbname =xyz;...' unexpected behavior
-Status:           Feedback
+Status:           No Feedback
 Type:             Feature/Change Request
 Package:          PDO related
 Operating System: Ubuntu 13.10
 PHP Version:      Irrelevant
 Private report:   N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2014-04-17 07:50:14] skvsn at ngs dot ru

Yep, that's the point.
The exact same code without the space there works fine.

------------------------------------------------------------------------
[2014-04-10 17:13:11] requinix@php.net

And the exact same code without the space there works?

------------------------------------------------------------------------
[2014-04-10 13:52:13] skvsn at ngs dot ru

PHP 5.5.3-1ubuntu2.2 (cli) (built: Feb 28 2014 20:03:35)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans

------------------------------------------------------------------------
[2014-04-10 13:50:46] skvsn at ngs dot ru

Description:
------------
PDO constructor would fail to understand you give database name, provided you pass $dsn like
'...;dbname =xyz;...', i.e. in case there's a whitespace in between
"dbname" and "=".

Test script:
---------------
$pdo = new \PDO("mysql:host=localhost;port=3306;dbname =$dbname;charset=utf8", $username,
$password);

$sth = $pdo->query("select * from $tablename");

var_dump($a->errorInfo());

Actual result:
--------------
// var_dump dsn:
string 'mysql:host=localhost;port=3306;dbname =mydatabase;charset=utf8' (length=66)

// var_dump username
string 'theuser' (length=14)

// var_dump password
string 'thepassword' (length=6)

// var_dump pdo->errorInfo()
array (size=3)
  0 => string '3D000' (length=5)
  1 => int 1046
  2 => string 'No database selected' (length=20)



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67056&edit=1


Thread (5 messages)

« previous php.bugs (#189474) next »