Commit graph

57 commits

Author SHA1 Message Date
Niels Dossche
4a79a5a59a
Fix GHSA-5hqh-c84r-qjcv: Integer overflow in the dblib quoter causing OOB writes 2024-11-20 11:05:48 +01:00
Christoph M. Becker
2bd58dbcc4
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix pdo_dblib ext test conflicts when run in parallel
2022-08-26 14:59:08 +02:00
Michael Voříšek
f86629569c
Fix pdo_dblib ext test conflicts when run in parallel
Closes GH-9430.
2022-08-26 14:57:13 +02:00
Nikita Popov
1e012ecb3f Fix bug #81405: Restore old PDO::PARAM_* values
Doctrine hardcodes the values of these constants, avoid changing
them.

Closes GH-7445.
2021-09-01 13:54:41 +02:00
Nikita Popov
455214d6f0 Skip bug_50755.phpt in repeat mode
This occasionally fails in repeat mode with:

> SQLSTATE[HY000]: General error: 20018 Transaction (Process ID 60)
> was deadlocked on lock resources with another process and has been
> chosen as the deadlock victim. Rerun the transaction.
2021-07-09 09:26:34 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Adam Baratz
4affb585a8 Remove flakiness from tests 2021-01-13 19:39:41 -05:00
Adam Baratz
b569698095 Add MSSQL setup to Azure Pipelines build 2021-01-11 21:46:41 -05:00
Adam Baratz
a07e75aa65 Skip test if bigint type is unsupported by active TDS version 2020-05-08 15:13:40 -04:00
Adam Baratz
bba9bc6863 Set non-default error mode to maintain expected behavior 2020-05-08 14:45:37 -04:00
Adam Baratz
e295266f8f Update FreeTDS version detection related to bug #72969 2020-05-08 14:34:00 -04:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Peter Kokot
d679f02295 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:33:09 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
fandrieu
a0ed09f92b Treat DATETIME2 columns like DATETIME 2017-11-10 17:20:33 -05:00
Adam Baratz
1027ed3767 Use TDS version attribute to determine whether to skip tests 2017-11-10 14:36:35 -05:00
fandrieu
b760b46216 Expose TDS version as \PDO::DBLIB_ATTR_TDS_VERSION attribute on \PDO instance 2017-11-10 14:21:07 -05:00
Adam Baratz
9ebb38ca1d Output column data for easier debugging 2017-11-08 17:12:33 -05:00
fandrieu
b72af30a53 Fix #74243: allow locales.conf to drive datetime format
Add a driver attribute, PDO::DBLIB_ATTR_DATETIME_CONVERT, to control.
2017-10-31 17:52:59 -04:00
fandrieu
014fd21b48 Implemented request #69592: allow 0-column rowsets to be skipped automatically
This adds a new attribute PDO::DBLIB_ATTR_SKIP_EMPTY_ROWSETS to enable automatic
skipping of empty rowsets.

This happens with some SQL commands (like PRINT or SET): a rowset with 0 columns
is returned by the driver.

With this option enabled, 0 columns rowsets are automatically skipped, mirroring
the behavior of the deprecated mssql extension.

Credits go to MiRacLe-RPZ for developping and promoting this patch.
2017-10-17 14:16:38 -04:00
Adam Baratz
4afce8ec8c Add PDO parameter types for national character set strings 2017-03-20 18:25:50 -04:00
Adam Baratz
f45e6364b4 Add test coverage for bug #72969
This was not an issue with pdo_dblib, but rather with FreeTDS. FreeTDS has been
fixed as of the fc820490336c50d5c175d2a15327383256add4c9 on that repo. These
tests will be skipped if a version of FreeTDS with that issue is present.

I only cleaned up this commit for pushing. For fixing the FreeTDS issue and
writing corresponding pdo_dblib tests, thanks to:
Jeff Farr <jefarr@wayfair.com>
2017-01-27 18:47:00 -05:00
Adam Baratz
9e18f1d4af Expose DB-Library version as \PDO::DBLIB_ATTR_VERSION attribute on \PDO instance 2017-01-27 18:38:56 -05:00
Adam Baratz
147a3dd379 style cleanup 2017-01-27 18:24:45 -05:00
Adam Baratz
0a2c02cb57 Fix #73396: bigint columns are returned as strings 2016-10-27 13:52:59 -04:00
Adam Baratz
d334d319f0 Limit size of result set for test query
This result set can be very large, depending on the database. This change
ensures this test won't be slow.
2016-09-21 16:21:33 -04:00
Peter LeBrun
dfd6baee0c PHP bug 67130: nextRowset should work with unfetched rows 2016-09-21 14:27:23 -04:00
Adam Baratz
f559fb7556 Skip test for early TDS versions 2016-09-14 11:06:54 -04:00
Adam Baratz
efadcb0390 Add common suite 2016-09-13 16:43:25 -04:00
Adam Baratz
91c49c4ab0 Handle SQLDECIMAL/SQLNUMERIC types, which are used by later TDS versions 2016-09-13 16:32:37 -04:00
Adam Baratz
9cdf2042bd Allow \PDO::setAttribute() to set pdo_dblib query timeouts 2016-09-13 16:13:26 -04:00
Adam Baratz
2302eef5c9 Never quote values as raw binary data
This reverts a1a18fca6e which was intended to fix
bug #52885. That commit introduced a BC break which wasn't universally
desirable. The issue of quoting binary data (or NVARCHAR strings, or other
nonstandard types) will have to be addressed separately.
2016-09-12 17:32:50 -04:00
Stanislav Malyshev
54f6c8d6df Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Use integer placeholders, since values can vary with the TDS version
2016-09-05 00:19:26 -07:00
Adam Baratz
84d495055d Use integer placeholders, since values can vary with the TDS version 2016-09-05 00:17:59 -07:00
Alexander Zhuravlev
a000bff2c3 pdo_dblib: stringify uniqidentifier field
Keep old 5.6 behavior: return Uniqidentifier value as 36-byte hex string (not binary),
when PDO::ATTR_STRINGIFY_FETCHES is TRUE

pdo_dblib: Stringify uniqidentifier field

Keep old 5.6 behavior: return Uniqidentifier value as 36-byte hex string (not binary),
when PDO::ATTR_STRINGIFY_FETCHES is TRUE

Tests added.

pdo_dblib: Stringify uniqidentifier field

Keep old 5.6 behavior: return Uniqidentifier value as 36-byte hex string (not binary),
when PDO::ATTR_STRINGIFY_FETCHES is TRUE

Tests fix.

pdo_dblib: Stringify uniqueidentifier field Added separate PDO::DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER attribute instead of PDO::ATTR_STRINGIFY_FETCHES.

pdo_dblib: Stringify uniqueidentifier field Added `getAttribute` support for PDO::DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER.

Simplify storage of stringify_uniqueidentifier attribute
2016-08-25 19:37:21 +02:00
Adam Baratz
8db64e919c Correct for connection with PDO::ATTR_STRINGIFY_FETCHES set to false 2016-07-08 15:54:52 +02:00
Anatol Belski
ea64d290fe fix test 2016-04-06 14:44:23 +02:00
Adam Baratz
ed3edc2f05 fix bug #71667 (emulate how mssql extension names "computed" columns) 2016-04-06 14:41:55 +02:00
Adam Baratz
1e1500a2bc return zvals instead of strings, cast or not based on stringify attribute 2016-04-06 12:18:53 +02:00
Anatol Belski
354a682c38 fix test 2016-04-06 08:21:10 +02:00
Anatol Belski
fd9137c00c add skip slow test 2016-04-06 08:18:32 +02:00
Adam Baratz
8a92fed532 Add driver-specific attributes for controlling calls to dbsetlogintime() and dbsettime() 2016-04-05 18:18:37 +02:00
Adam Baratz
9fcfc18ca9 Fix #71943: dblib_handle_quoter needs to allocate an extra byte 2016-04-04 17:33:49 +02:00
Adam Baratz
2e18d438b0 limit size of result set so unit test runs reliably 2016-03-01 17:15:36 -05:00
Anatol Belski
d78220fb2c add test for bug #68957 2016-02-29 18:43:03 +01:00
Anatol Belski
53c036b30b Fixed #54648 PDO::MSSQL forces format of datetime fields
adopted patch by steven dot lambeth at gmx dot de
2016-02-29 17:04:49 +01:00
MiRacLe.RPZ
4c8f064d7d testcase fot bug #69757 2015-10-18 11:10:39 +02:00