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

pdo_dblib wrong protocol version 5.0 #13475

Open
hanisko opened this issue Feb 22, 2024 · 9 comments
Open

pdo_dblib wrong protocol version 5.0 #13475

hanisko opened this issue Feb 22, 2024 · 9 comments

Comments

@hanisko
Copy link

hanisko commented Feb 22, 2024

Description

The following code:

<?php
$connection = new PDO('dblib:version=5.0;host=example', 'username', 'password');

Problem is with Sybase System 10 and above > use protocol version 5.0 but here link

{"5.0",DBVERSION_70} /* FIXME: This does not work with Sybase, but environ will */
  • sybase generate error log after each connection (try to connect with protocol version 7.0)
server  Error: 1621, Severity: 18, State: 1
server  Type '12' not allowed before login.

PHP Version

PHP 8.2

Operating System

No response

@SakiTakamachi
Copy link
Member

I'll confirm this by early next week.

@SakiTakamachi SakiTakamachi self-assigned this Feb 23, 2024
@SakiTakamachi
Copy link
Member

There are so many ways to install sybase that I don't know which is the correct one...
Is there a recommended method?

@hanisko
Copy link
Author

hanisko commented Feb 27, 2024

There are so many ways to install sybase that I don't know which is the correct one... Is there a recommended method?

You can install it via enterprise edition:
https://www.sap.com/products/technology-platform/sybase-ase/trial.html

SAP ASE, enterprise edition, contains all options for your evaluation. It expires after 90 days and can be used only in nonproduction environments.

@hanisko
Copy link
Author

hanisko commented Feb 29, 2024

Here is repository, which simulate 5.0 protocol bug https://github.com/hanisko/php_dblib (sybase 16 + latest php)

@SakiTakamachi
Copy link
Member

@hanisko
Thank you, docker-compose.yml in your repository was very helpful.
But I'm sorry. I actually just moved and my internet is incredibly slow until March 7th. I'm trying to download sybase, but I suspect it will be March 7th before that...

It may not be until March 7th that we can properly investigate this issue.

@SakiTakamachi
Copy link
Member

Suddenly, my unstable internet connection suddenly became faster and by chance I was able to download all of sybase.
I was able to reproduce it in my environment as well. I'll investigate this issue.

@SakiTakamachi
Copy link
Member

SakiTakamachi commented Feb 29, 2024

@hanisko

I got it.

I will write from the conclusion, please try specifying 10.0 instead of 5.0. Perhaps it will do what you want.


in detail

Excerpt from the following page:
https://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc20155_1251/html/newfesd/BABHHDEI.htm

DBVERSION_100 — DB-Library is running with TDS version 5.0 protocol

I've found some of the same information on other sites, so it seems certain that DBVERSION_100 means 5.0.

But PHP seems to have been interpreting this as 10.0 for a long time.

,{"10.0",DBVERSION_100}

Fixing this will definitely result in a BC Break, so it can't be fixed, at least not on the stable branch. It may be possible to fix it in the master branch (future 8.4), but first I need to investigate the scope of the impact of fixing this.

@hanisko
Copy link
Author

hanisko commented Mar 1, 2024

Yes, you are right, "10.0" solved the issue, it doesn't generate "Error: 1621, Severity: 18, State: 1" into sybae logs.

Comment on line 450 "FIXME: This does not work with Sybase" and pointig version 5.0, 6.0, 7.0 to same value "DBVERSION_70" confused me. Maybe just better documentation for "version" values in dsn will be helpfull https://www.php.net/manual/en/ref.pdo-dblib.connection.php

This comment was also confusing https://www.php.net/manual/en/ref.pdo-dblib.connection.php#118644 where is statement about "version from dsn" = "tds version" which is not correct with 5.0 protocol (only info in docs about version in dsn)

I hope it will be better documented or fixed in future versions.

Thanks for your help :-)

@SakiTakamachi
Copy link
Member

I have posted about this issue to the mailing list.
https://externals.io/message/122538

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

3 participants