Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlsrv driver needs encrypt state in config array #38076

Closed
DaniDuesentrieb opened this issue Jun 16, 2022 · 4 comments
Closed

sqlsrv driver needs encrypt state in config array #38076

DaniDuesentrieb opened this issue Jun 16, 2022 · 4 comments

Comments

@DaniDuesentrieb
Copy link

Steps to reproduce the issue

Tested with php sql_srv extension 5.10.0

If you want to Connect to an unencrpyted MsSQL Server with the following connection array, a connection could not be established, because the encryption could not be set.

   $option['driver'] = 'sqlsrv'; 
    $option['host'] = 'server\\instancename, 1433';
    $option['port'] = 1433;
    $option['user'] = 'user';
    $option['password'] = 'pass';
    $option['database'] = 'DBName';
    $option['prefix'] = '';

    return JDatabaseDriver::getInstance($option);

Expected result

In the config array there is an option "encrypt" to set the state.

   $option['driver'] = 'sqlsrv'; 
    $option['host'] = 'server\\instancename, 1433';
    $option['port'] = 1433;
    $option['user'] = 'user';
    $option['password'] = 'pass';
    $option['database'] = 'DBName';
    $option['prefix'] = '';
    $option['encrypt'] = false;

    return JDatabaseDriver::getInstance($option);

Actual result

System information (as much as possible)

Jommla 4.1.4
PHP 7.4.28
Linux Ubuntu Webserver
sql_srv extension 5.10.0

Additional comments

In the file libraries\vendor\joomla\database\src\Sqlsrv\SqlsrvDriver.php at line 117 to 124 the config array needs the option encrypt, so the array must be change from this:

	$config = [
		'Database'             => $this->options['database'],
		'uid'                  => $this->options['user'],
		'pwd'                  => $this->options['password'],
		'CharacterSet'         => 'UTF-8',
		'ReturnDatesAsStrings' => true
	];

to this:

	$config = [
		'Database'             => $this->options['database'],
		'uid'                  => $this->options['user'],
		'pwd'                  => $this->options['password'],
		'CharacterSet'         => 'UTF-8',
		'ReturnDatesAsStrings' => true,
		'encrypt'	       => $this->options['encrypt']
	];
@richard67
Copy link
Member

@DaniDuesentrieb Could you report this issue here https://github.com/joomla-framework/database/issues ? Thanks in advance.

@DaniDuesentrieb
Copy link
Author

@richard67 Issue reported at joomla-framework/database#265


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38076.

@richard67
Copy link
Member

@DaniDuesentrieb Thanks.

@alikon
Copy link
Contributor

alikon commented Jun 16, 2022

closing here as has been opened at joomla-framework/database#265

@alikon alikon closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants