Commit Graph

259 Commits

Author SHA1 Message Date
Christoph M. Becker
3244e0785d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
2021-07-28 10:53:27 +02:00
Christoph M. Becker
98049e8b9a
Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
If `P->len` is negative (not only when it is `SQL_NULL_DATA`), we must
not go on, because the following code can't deal with that.  This means
that the output parameter will be set to `NULL` without any indication
what went wrong, but it's still better than crashing.

Closes GH-7295.
2021-07-28 10:51:38 +02:00
Christoph M. Becker
63c558bcbb
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #44643: bound parameters ignore explicit type definitions
2021-05-12 13:47:01 +02:00
Christoph M. Becker
23a3bbb468
Fix #44643: bound parameters ignore explicit type definitions
If `SQLDescribeParam()` fails for a parameter, we must not assume
`SQL_LONGVARCHAR` for any param which is not `PDO_PARAM_LOB`.  At least
mapping `PDO_PARAM_INT` to `SQL_INTEGER` should be safe, and not
introduce a BC break.

Closes GH-6973.
2021-05-12 13:30:51 +02:00
Remi Collet
f421ebc056
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Improve fix for #80783
2021-04-08 15:28:29 +02:00
Remi Collet
25f5a1b2e1
Improve fix for #80783 2021-04-08 15:28:03 +02:00
Christoph M. Becker
97cfdcd73b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
2021-03-18 15:18:53 +01:00
Christoph M. Becker
bccca0b53a Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
It is not guaranteed, that the driver inserts only a single NUL byte at
the end of the buffer.  Apparently, there is no way to find out the
actual data length in the buffer after calling `SQLGetData()`, so we
adjust after the next `SQLGetData()` call.

We also prevent PDO::ODBC_ATTR_ASSUME_UTF8 from fetching garbage, by
fetching all chunks with the same C type.

Closes GH-6716.
2021-03-18 15:13:27 +01:00
Nikita Popov
34e39ebaf5 Fix signed/unsigned warnings in PDO ODBC
Add add skipif to test.

(cherry picked from commit aa58db7232)
2021-03-17 16:33:32 +01:00
Christoph M. Becker
99b3631e9a Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #67465: NULL Pointer dereference in odbc_handle_preparer
2020-09-28 22:59:51 +02:00
Christoph M. Becker
f1d8395c77 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #67465: NULL Pointer dereference in odbc_handle_preparer
2020-09-28 22:58:16 +02:00
Christoph M. Becker
6acfb79276 Fix #67465: NULL Pointer dereference in odbc_handle_preparer
We have to initialize `stmt->driver_data` before we use it.

Closes GH-6225.
2020-09-28 22:57:01 +02:00
George Peter Banyard
24e2ba26b4 Do not register quoter handler in ODBC
This functionallity is not (yet) implemented and therefore gives a bogus error while using PDO
2020-09-28 18:51:35 +01:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
Closes GH-6173
2020-09-20 19:41:47 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
ec22e5aa38
Get rid of empty function entries
Closes GH-5917
2020-08-01 10:07:05 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Christoph M. Becker
38177dcb42 Properly initialize displaysize
From Microsoft's `SQLColAttribute()` documentation[1]:

| Please note that some drivers may only write the lower 32-bit or
| 16-bit of a buffer and leave the higher-order bit unchanged.
| Therefore, applications should initialize the value to 0 before
| calling this function.

[1] <https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolattribute-function>
2020-06-24 12:07:58 +02:00
Christoph M. Becker
5a04796f76 Fix MSVC level 1 (severe) warnings
We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>
2020-06-05 11:17:05 +02:00
George Peter Banyard
50af36a8aa Fix [-Wundef] warning in PDO ODBC extension 2020-05-20 16:29:53 +02:00
Christoph M. Becker
72737b0660 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79038: PDOStatement::nextRowset() leaks column values
2020-02-17 22:55:16 +01:00
Christoph M. Becker
3090c88f55 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79038: PDOStatement::nextRowset() leaks column values
2020-02-17 22:54:16 +01:00
Christoph M. Becker
08073b0658 Fix #79038: PDOStatement::nextRowset() leaks column values
Firstly, we must not rely on `stmt->column_count` when freeing the
driver specific column values, but rather store the column count in
the driver data.  Since the column count is a `short`, 16 bit are
sufficient, so we can store it in reserved bits of `pdo_odbc_stmt`.

Furthermore, we must not allocate new column value storage when the
statement is not executed, but rather when the column value storage has
not been allocated.

Finally, we have to introduce a driver specific `cursor_closer` to
avoid that `::closeCursor()` calls `odbc_stmt_next_rowset()` which then
frees the column value storage, because it may be still needed for
bound columns.
2020-02-17 22:53:02 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Peter Kokot
f91ffe5915 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove conditional calls of always available macros
2019-07-14 22:24:59 +02:00
Peter Kokot
94421e5724 Remove conditional calls of always available macros
These checks were once relevant for these extensions in PECL and PHP
versions without availability of the checked macros.

Closes GH-4405
2019-07-14 22:24:21 +02:00
Peter Kokot
4f5c6bc15e Merge branch 'PHP-7.4'
* PHP-7.4:
  Simplify PHP_CHECK_PDO_INCLUDES calls
2019-07-08 10:26:08 +02:00
Peter Kokot
a39ea91753 Simplify PHP_CHECK_PDO_INCLUDES calls
Conditional checks were once used for backwards compatibility with
phpize from PHP versions that didn't have this macro call yet.

Closes GH-4376
2019-07-08 10:24:41 +02:00
Christoph M. Becker
f0eb642cb0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Prevent further potential test conflicts
2019-05-14 13:20:38 +02:00
Christoph M. Becker
2244a7d9af Prevent further potential test conflicts 2019-05-14 13:19:58 +02:00
Peter Kokot
2cf90bb2f0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Normalize comments in *nix build system m4 files
2019-05-12 18:51:50 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Peter Kokot
6426420f61 Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace dirname(__FILE__) by __DIR__ in tests
2019-03-15 23:36:47 +01:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Dmitry Stogov
c56bd7e220 Merge branch 'PHP-7.4'
* PHP-7.4:
  Cleanup unused module globals
2019-03-12 13:44:25 +03:00
Dmitry Stogov
5aa1176238 Cleanup unused module globals 2019-03-12 13:44:05 +03:00
Peter Kokot
d0fd9fe977 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add AS_HELP_STRING to *nix build configure options
2019-03-07 20:38:04 +01:00
Peter Kokot
9df6a1e4dd Add AS_HELP_STRING to *nix build configure options
The Autoconf's default AS_HELP_STRING macro can properly format help
strings [1] so watching out if columns are aligned manually is not
anymore.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
2019-03-07 20:36:59 +01:00
Kalle Sommer Nielsen
fddc751024 Removed pdo_odbc.db2_instance_name 2019-03-01 01:24:53 +02:00
Rodrigo Prado
dc1937e386 updated typo in test
User Group: PHPSP #phptestfestbrasil
2019-02-09 00:07:20 +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
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02: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
Peter Kokot
b746e69887 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:32:30 +02:00
Peter Kokot
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Peter Kokot
1ad08256f3 Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

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-14 12:56:38 +02:00