FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18704&edit=1

ID: 18704
Updated by: daniel.oconnor@gmail.com
Reported By: wizlong79 at gmail dot com
Summary: Unlimited recursion On connection with charset
-Status: Open
+Status: Duplicate
Type: Bug
Package: MDB2_Driver_sqlsrv
Operating System: Windows 7
Package Version: 1.5.0b3
PHP Version: 5.3.6
Roadmap Versions:
New Comment:

-Status: Open
+Status: Duplicate
Bug #18708


Previous Comments:
------------------------------------------------------------------------

[2011-08-03 13:31:53] wizlong

Description:
------------
If I connect with specifying charset, program goes to unlimited
recusion.

The reason may be:
When charset is specified, an undefined method
(MDB2_Driver_Common::setCharset) is called.

so, I modified "PEAR/MDB2/Driver/sqlsrv.php".
remove from line 350 ~ 356.
Insert into line 336 following code:
if (!empty($this->dsn['charset'])) {
$params['CharacterSet'] = $this->dsn['charset'];
}


Test script:
---------------
error_reporting(E_ALL);

require_once 'PEAR.php';
require_once 'MDB2.php';

$dsn = array(
"phptype" => "sqlsrv",
"user" => "sa",
"password" => "11111111",
"hostspec" => "(local)",
"database" => "abcd",
"charset" => "utf-8",
);

$db = MDB2::factory($dsn);

$sql ="SELECT CONVERT(text, "help help") Contents;";
$rs = $db->query($sql);
while($row = $rs->fetchRow(MDB2_FETCHMODE_ASSOC)){
var_dump($row);
}


Actual result:
--------------
Fatal error: Maximum function nesting level of '100' reached, aborting!
in C:\php\PEAR\MDB2\Driver\sqlsrv.php on line 374

Call Stack:
0.0009 323976 1. {main}()
D:\workspace\sc_crawl\application\test.php:0
0.0157 1682584 2. MDB2_Driver_Common->query()
D:\workspace\sc_crawl\application\test.php:22
0.0157 1682712 3. MDB2_Driver_Common->getConnection()
C:\php\PEAR\MDB2.php:2541
0.0157 1682712 4. MDB2_Driver_sqlsrv->connect()
C:\php\PEAR\MDB2.php:1749
0.0157 1682712 5. MDB2_Driver_sqlsrv->_doConnect()
C:\php\PEAR\MDB2\Driver\sqlsrv.php:386
0.0829 1684992 6. MDB2_Driver_Common->setCharset()
C:\php\PEAR\MDB2\Driver\sqlsrv.php:351
0.0830 1685208 7. MDB2_Driver_Common->raiseError()
C:\php\PEAR\MDB2.php:2230
0.0830 1685392 8. MDB2_Driver_sqlsrv->errorInfo()
C:\php\PEAR\MDB2.php:1442
0.0830 1685424 9. MDB2_Driver_sqlsrv->connect()
C:\php\PEAR\MDB2\Driver\sqlsrv.php:117
0.0830 1685424 10. MDB2_Driver_sqlsrv->_doConnect()
C:\php\PEAR\MDB2\Driver\sqlsrv.php:386
0.0884 1686208 11. MDB2_Driver_Common->setCharset()
C:\php\PEAR\MDB2\Driver\sqlsrv.php:351
0.0884 1686424 12. MDB2_Driver_Common->raiseError()
C:\php\PEAR\MDB2.php:2230
0.0884 1686608 13. MDB2_Driver_sqlsrv->errorInfo()
C:\php\PEAR\MDB2.php:1442

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 4, '11 at 5:13a
activeAug 4, '11 at 5:13a
posts1
users1
websitepear.php.net

1 user in discussion

Daniel Oconnor: 1 post

People

Translate

site design / logo © 2022 Grokbase