php.net |  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
Votes:3
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sivavivekanantha at gmail dot com
New email:
PHP Version: OS:

 

 [2013-02-06 04:52 UTC] sivavivekanantha at gmail dot com
Description:
------------
PDO::__construct(): Called dbsetopt with parameter 3 NULL (severity 11)


/var/www/framework/db/CDbConnection.php(423)

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 = '';	
	       $command->execute();
		} 
		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.)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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 https://github.com/php/php-
src/pull/306. Waiting on php developers to roll this into their release.
 [2013-06-01 07:08 UTC] ssufficool@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ssufficool
 [2013-06-01 07:08 UTC] ssufficool@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
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: Mon Nov 29 17:03:14 2021 UTC