Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122538 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 1B49D1AD8F6 for ; Sat, 2 Mar 2024 17:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1709389222; bh=h6iiSNP/2HpQcZRQ5yT71EqHvzjVCMsThMD7P2m70Y0=; h=From:Subject:Date:To:From; b=f1QaoXfpR2LdQP8kKneL5NHwPNRCWNilQnw/2lxFAYlEgn5a/ql7gzjO8zqD5nK6n VVbKbIlnrbcbZ2uuP3B8mxYSjd8Y/zngRSw9YypyzWy/xe23RSyY/aGkG+MJCCOiD8 xNOEZ+A7QmCpgnqg8RyF8vWzwgfycNKX55qZeG2o5psqZZVBlDS4KHWb/JqbRUcR/9 gYa6CnlKe0NAPKByVATmAGLwCLRiFhCN/eho7MjIP3l3iJw8U36QsGUrKKQCW5q3rQ U2EGX1tbzEmUe70+VrIQtlI0Xs1J27yq3aREaLYNlQVMeSRcSAKPFVnnfxAeigA8rN lZqnGBHAxxmxg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5E60218936E for ; Sat, 2 Mar 2024 14:20:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 2 Mar 2024 14:20:19 +0000 (UTC) Received: from smtpclient.apple (softbank060105250051.bbtec.net [60.105.250.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 609FE401D1 for ; Sat, 2 Mar 2024 23:20:05 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1709389205; bh=h6iiSNP/2HpQcZRQ5yT71EqHvzjVCMsThMD7P2m70Y0=; h=From:Subject:Date:To:From; b=g1KhsRUmngiWj9ajD56BkXRLezLJDUc7fl5VnIwtFYYjAUFixUFJxAyCNNM1WXkR7 dciIQbaiYQ5DwIpqLKaO18v5rBKPhl7WCYnR4qLrxXw6J1OPESCNOq6aWgBk4IZp/3 IDKYaqerUioodgmeQhHMTbl69SgyhCHSFkIsg2/g= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: [PHP-DEV] [pdo_dblib] Correct TDS protocol version Message-ID: Date: Sat, 2 Mar 2024 23:19:53 +0900 To: php internals X-Mailer: Apple Mail (2.3731.700.6) From: saki@sakiot.com (Saki Takamachi) Hi internals, There seems to be an error in the handling of pdo_dblib's TDS protocol = version, so I'm thinking of fixing these. Through this email, I would = like to discuss the appropriate time and method for correction. =E2=80=94 For your reference =E2=80=94 There are several derivatives of "SQL Server", with Microsoft SQL Server = being the most popular. These communicate using the TDS protocol. = However, the TDS protocol standards are not strictly unified, and the = Sybase protocol and Microsoft SQL Server have different standards, so = each is defined as a different "version" of the TDS protocol. Therefore, pdo_dblib allows the user to specify a "version" for dsn and = select which protocol version to use. =E2=80=94 End =E2=80=94 The related issue: https://github.com/php/php-src/issues/13475 The types and details of protocol versions are explained in the FreeTDS = user guide: https://www.freetds.org/userguide/ChoosingTdsProtocol.html Summarize the explanation. 4.2: Available for older Sybase and Microsoft SQL Servers 5.0: Available for new Sybase 7.0 - 7.4: Available for new Microsoft SQL Server Notes: - There's actually a version too called 4.6, which appears to be for = Open SQL Server. However, I plan to explore this in a little more = detail. - It seems that there are two types of 5.0, so I will investigate this = as well. Now take a look at the pdo_dblib implementation in php-src: = https://github.com/php/php-src/blob/ffc6f192a8f475dfdff942bb22f509d1eefd08= 47/ext/pdo_dblib/dblib_driver.c#L447 Excerpt the incorrect part: ``` {"5.0",DBVERSION_70} /* FIXME: This does not work with Sybase, but = environ will */ {"6.0",DBVERSION_70} {"8.0",DBVERSION_72} {"10.0",DBVERSION_100} ``` `DBVERSION_70` (meaning 7.0) is specified for 5.0 and 6.0. And as far as = I can tell, there is no version called 6.0. (`DBVERSION_60` is also not = defined.) There is also no version 8.0, but according to the FreeTDS user guide, = it appears that versions of FreeTDS older than 1.3 can specify this, as = 7.1 was originally planned to be released as 8.0. However, PHP treats = 8.0 as an alias for 7.2 rather than 7.1, which is incorrect anyway. `DBVERSION_50`, which would be used for 5.0, is also not defined, but = according to the following page, `DBVERSION_100` means 5.0. = https://infocenter.sybase.com/help/index.jsp?topic=3D/com.sybase.dc20155_1= 251/html/newfesd/BABHHDEI.htm Excerpt: > DBVERSION_100 =E2=80=94 DB-Library is running with TDS version 5.0 = protocol So remove 6.0, 8.0 and 10.0 and 5.0 should look like this: ``` {"5.0",DBVERSION_100} ``` These changes are definitely a BC break. Therefore, I would appreciate = any feedback you may have, including which versions should I make = changes to? Regards. Saki