|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64161 PDO::__construct(): Called dbsetopt with parameter 3 NULL (severity 11)
Submitted: 2013-02-06 04:52 UTC Modified: 2013-06-01 07:08 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: sivavivekanantha at gmail dot com Assigned: ssufficool (profile)
Status: Closed Package: PDO related
PHP Version: 5.4.11 OS: linux centos 6
Private report: No CVE-ID: None
 [2013-02-06 04:52 UTC] sivavivekanantha at gmail dot com
PDO::__construct(): Called dbsetopt with parameter 3 NULL (severity 11)


411     protected function createPdoInstance()
412     {
413         $pdoClass=$this->pdoClass;
414         if(($pos=strpos($this->connectionString,':'))!==false)
415         {
416             $driver=strtolower(substr($this->connectionString,0,$pos));
417             if($driver==='mssql' || $driver==='dblib')
418                 $pdoClass='CMssqlPdoAdapter';
419             elseif($driver==='sqlsrv')
420                 $pdoClass='CMssqlSqlsrvPdoAdapter';
421         }
422         return new $pdoClass($this->connectionString,$this->username,
423                                     $this->password,$this->_attributes);

Test script:
$sql = "[sp_Language] :Language_Code, :Language_Name, :Active, :Disp_Order, :Action ";
	   $command = $this->createCommand($sql);
	   $command->bindParam(":Language_Code",    $languageCode,  PDO::PARAM_INT);
	   $command->bindParam(":Language_Name",	$language,		PDO::PARAM_STR);
	   $command->bindParam(":Active",			$active,		PDO::PARAM_STR);
	   $command->bindParam(":Disp_Order",	  	$displayOrder,	PDO::PARAM_INT);	 	   
	   $command->bindParam(":Action",			$action,		PDO::PARAM_INT);
 try {
		   $this->msg = '';	
		catch(Exception $e)
			//$this->msg = substr($ex->getMessage(),0,-30);
			$this->msg = $e->getMessage();
//			$this->msg = substr($e->errorInfo[2],0,-30);


Expected result:
PDO::__construct(): Called dbsetopt with parameter 3 NULL (severity 11) 

Actual result:
Language Name Already Exists..this custom Exception shown in my UI

(I'm Using Sql stored procedure, that procedure throw custom message use Raiserror command. That custom exception shown in my yii UI.)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-20 18:41 UTC] jwatson at fh dot org
This may be a duplicate of issue #63638.

If so, a patch/pull request was submitted at
src/pull/306. Waiting on php developers to roll this into their release.
 [2013-06-01 07:08 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: ssufficool
 [2013-06-01 07:08 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

This is related to the quoted identifier passing NULL to FreeTDS. This has been 
fixed in git master.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 01 18:03:35 2021 UTC